| Function (anonymous_1) | |
|---|---|
| ✓ Was called | var vowFs = refunction() {··· StringChecker.apply(this, arguments); }; |
| Function (anonymous_2) | |
|---|---|
| ✓ Was called | var vowFs = require('vow-fs');function(config) {··· StringChecker.prototype.configure.call(this, config); this._fileExtensions = this._configuration.getFileExtensions(); }; |
| Function (anonymous_3) | |
|---|---|
| ✓ Was called | var vowFs = require('vow-fs'function() {··· var method = this._configuration.getFix() === true ? this.fixPath : this.checkPath; return method.apply(this, arguments); }; |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | var vowFs = require('vow-fs');··· var Vow = require('vow'); this.fixPath : this.checkPath; |
| ✓ Negative was returned (: ...) | var vowFs = require('vow-fs');··· var Vow = require('vow'); var StringCheckthis.checkPath; |
| Function (anonymous_4) | |
|---|---|
| ✓ Was called | var vowFs = require('vow-fs');function(path) {··· if (this._configuration.isFileExcluded(path)) { return Vow.resolve(null); } return vowFs.read(path, 'utf8').then(function(data) { return this.checkString(data, path); }, this); }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var vowFs = require('vow-fs');··· var Vow = require('{ return Vow.resolve(null); } |
| ✓ Negative was executed (else) | var v··· return vowFs.read(path, 'utf8').then(function(data) { |
| Function (anonymous_5) | |
|---|---|
| ✓ Was called | var vowFs = require('vow-fs');··· var Vow = function(data) { return this.checkString(data, path); }, this); |
| Function (anonymous_6) | |
|---|---|
| ✓ Was called | var vowFs = require('vow-fs'function(path) {··· if (this._configuration.isFileExcluded(path)) { return Vow.resolve(null); } return vowFs.read(path, 'utf8').then(function(data) { var result = this.fixString(data, path); return vowFs.write(path, result.output).then(function() { return result.errors; }); }, this); }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var vowFs = require('vow-fs');··· var Vow = require('{ return Vow.resolve(null); } |
| ✓ Negative was executed (else) | var v··· return vowFs.read(path, 'utf8').then(function(data) { |
| Function (anonymous_7) | |
|---|---|
| ✓ Was called | var vowFs = require('vow-fs');··· var Vow = function(data) { var result = this.fixString(data, path); return vowFs.write(path, result.output).then(function() { return result.errors; }); }, this); |
| Function (anonymous_8) | |
|---|---|
| ✓ Was called | var vowFs = require('vow-fs');··· var Vow = require('vowfunction() { return result.errors; }); |
| Function (anonymous_9) | |
|---|---|
| ✓ Was called | var vowFs = require('vow-fs');··· vfunction(path) { if (this._configuration.isFileExcluded(path)) { return Vow.resolve(null); } if (!this._configuration.shouldExtractFile(path)) { return Vow.resolve(null); } return vowFs.read(path, 'utf8').then(function(data) { var result = extractJs(path, data); result.sources.forEach(function(script) { this.checkString(script.source, path).getErrorList().forEach(function(error) { error.line += script.line; error.column += script.offset; result.addError(error); }); }, this); return result.errors; }, this); }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var vowFs = require('vow-fs');··· var Vow = require('{ return Vow.resolve(null); } |
| ✓ Negative was executed (else) | var v··· if (!this._configuration.shouldExtractFile(path)) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var vowFs = require('vow-fs');··· var Vow = require('vow'{ return Vow.resolve(null); } |
| ✓ Negative was executed (else) | var v··· return vowFs.read(path, 'utf8').then(function(data) { |
| Function (anonymous_10) | |
|---|---|
| ✓ Was called | var vowFs = require('vow-fs');··· var Vow = function(data) { var result = extractJs(path, data); result.sources.forEach(function(script) { this.checkString(script.source, path).getErrorList().forEach(function(error) { error.line += script.line; error.column += script.offset; result.addError(error); }); }, this); return result.errors; }, this); |
| Function (anonymous_11) | |
|---|---|
| ✓ Was called | var vowFs = require('vow-fs');··· function(script) { this.checkString(script.source, path).getErrorList().forEach(function(error) { error.line += script.line; error.column += script.offset; result.addError(error); }); }, this); |
| Function (anonymous_12) | |
|---|---|
| ✓ Was called | var vowFs = require('vow-fs');··· var Vow = require('vow'); var StringCheckefunction(error) { error.line += script.line; error.column += script.offset; result.addError(error); }); |
| Function (anonymous_13) | |
|---|---|
| ✓ Was called | var vowFs = require('vow-fs');··· var function(path) { return this._processDirectory(path, this.checkFile.bind(this)); }; |
| Function (anonymous_14) | |
|---|---|
| ✓ Was called | var vowFs = require('vow-fs');function(path) {··· return this._processPath(path, this.checkFile.bind(this)); }; |
| Function (anonymous_15) | |
|---|---|
| ✓ Was called | var vowFs = require('vow-fs'function(path) {··· return this._processPath(path, this.fixFile.bind(this)); }; |
| Function (anonymous_16) | |
|---|---|
| ✓ Was called | var vowFs = require('vow-fs');··· var Vowfunction(path, fileHandler) { return vowFs.listDir(path).then(function(filenames) { return Vow.all(filenames.map(function(filename) { var fullname = path + '/' + filename; if (this._configuration.isFileExcluded(fullname)) { return []; } return vowFs.stat(fullname).then(function(stat) { if (stat.isDirectory()) { return this._processDirectory(fullname, fileHandler); } if (!this._hasCorrectExtension(fullname)) { if (!this._configuration.shouldExtractFile(fullname)) { return []; } return this.extractFile(fullname); } return fileHandler(fullname); }, this); }, this)).then(function(results) { return [].concat.apply([], results); }); }, this); }; |
| Function (anonymous_17) | |
|---|---|
| ✓ Was called | var vowFs = require('vow-fs');··· var Vfunction(filenames) { return Vow.all(filenames.map(function(filename) { var fullname = path + '/' + filename; if (this._configuration.isFileExcluded(fullname)) { return []; } return vowFs.stat(fullname).then(function(stat) { if (stat.isDirectory()) { return this._processDirectory(fullname, fileHandler); } if (!this._hasCorrectExtension(fullname)) { if (!this._configuration.shouldExtractFile(fullname)) { return []; } return this.extractFile(fullname); } return fileHandler(fullname); }, this); }, this)).then(function(results) { return [].concat.apply([], results); }); }, this); |
| Function (anonymous_18) | |
|---|---|
| ✓ Was called | var vowFs = require('vow-fs');··· var Vofunction(filename) { var fullname = path + '/' + filename; if (this._configuration.isFileExcluded(fullname)) { return []; } return vowFs.stat(fullname).then(function(stat) { if (stat.isDirectory()) { return this._processDirectory(fullname, fileHandler); } if (!this._hasCorrectExtension(fullname)) { if (!this._configuration.shouldExtractFile(fullname)) { return []; } return this.extractFile(fullname); } return fileHandler(fullname); }, this); }, this)).then(function(results) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var vowFs = require('vow-fs');··· var Vow = require('vow'); var S{ return []; } |
| ✓ Negative was executed (else) | var vowFs = r··· return vowFs.stat(fullname).then(function(stat) { |
| Function (anonymous_19) | |
|---|---|
| ✓ Was called | var vowFs = require('vow-fs');··· var Vow = requfunction(stat) { if (stat.isDirectory()) { return this._processDirectory(fullname, fileHandler); } if (!this._hasCorrectExtension(fullname)) { if (!this._configuration.shouldExtractFile(fullname)) { return []; } return this.extractFile(fullname); } return fileHandler(fullname); }, this); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var vowFs = require('vow-fs');··· var Vow ={ return this._processDirectory(fullname, fileHandler); } |
| ✓ Negative was executed (else) | var vowFs = requi··· if (!this._hasCorrectExtension(fullname)) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var vowFs = require('vow-fs');··· var Vow = require('vow'); v{ if (!this._configuration.shouldExtractFile(fullname)) { return []; } return this.extractFile(fullname); } |
| ✓ Negative was executed (else) | var vowFs = requi··· return fileHandler(fullname); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var vowFs = require('vow-fs');··· var Vow = require('vow'); var StringChecker{ return []; } |
| ✓ Negative was executed (else) | var vowFs = require('··· return this.extractFile(fullname); |
| Function (anonymous_20) | |
|---|---|
| ✓ Was called | var vowFs = require('vofunction(results) {··· return [].concat.apply([], results); }); |
| Function (anonymous_21) | |
|---|---|
| ✓ Was called | var vowFs = require('vow-fs');··· vafunction(path, fileHandler) { path = path.replace(/\/$/, ''); return vowFs.exists(path).then(function(exists) { if (!exists) { throw new Error('Path ' + path + ' was not found.'); } return vowFs.stat(path).then(function(stat) { if (stat.isDirectory()) { return this._processDirectory(path, fileHandler); } return fileHandler(path).then(function(errors) { if (errors) { return [errors]; } return []; }); }, this); }, this); }; |
| Function (anonymous_22) | |
|---|---|
| ✓ Was called | var vowFs = require('vow-fs');··· var function(exists) { if (!exists) { throw new Error('Path ' + path + ' was not found.'); } return vowFs.stat(path).then(function(stat) { if (stat.isDirectory()) { return this._processDirectory(path, fileHandler); } return fileHandler(path).then(function(errors) { if (errors) { return [errors]; } return []; }); }, this); }, this); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var vowFs = require('{··· throw new Error('Path ' + path + ' was not found.'); } |
| ✓ Negative was executed (else) | var vowFs··· return vowFs.stat(path).then(function(stat) { |
| Function (anonymous_23) | |
|---|---|
| ✓ Was called | var vowFs = require('vow-fs');··· var Vofunction(stat) { if (stat.isDirectory()) { return this._processDirectory(path, fileHandler); } return fileHandler(path).then(function(errors) { if (errors) { return [errors]; } return []; }); }, this); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var vowFs = require('vow-fs');··· var V{ return this._processDirectory(path, fileHandler); } |
| ✓ Negative was executed (else) | var vowFs = r··· return fileHandler(path).then(function(errors) { |
| Function (anonymous_24) | |
|---|---|
| ✓ Was called | var vowFs = require('vow-fs');··· var Vow = rfunction(errors) { if (errors) { return [errors]; } return []; }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var vowFs = require('vow-fs'{··· return [errors]; } |
| ✓ Negative was executed (else) | var vowFs = requi··· return []; |
| Function (anonymous_25) | |
|---|---|
| ✓ Was called | var vowFs = require('vow-fs');··· function() { return this._processStdin(this.checkString.bind(this)); }; |
| Function (anonymous_26) | |
|---|---|
| ✓ Was called | var vowFs = require('vow-fs')function() {··· return this._processStdin(this.fixString.bind(this)); }; |
| Function (anonymous_27) | |
|---|---|
| ✓ Was called | var vowFs = require('vow-fs');··· varfunction(stdinHandler) { var stdInput = []; var deferred = Vow.defer(); process.stdin.setEncoding('utf8'); process.stdin.on('data', function(chunk) { stdInput.push(chunk); }); process.stdin.on('end', function() { deferred.resolve(stdinHandler(stdInput.join(''))); }); return deferred.promise(); }; |
| Function (anonymous_28) | |
|---|---|
| ✓ Was called | var vowFs = require('vow-fs')function(chunk) {··· stdInput.push(chunk); }); |
| Function (anonymous_29) | |
|---|---|
| ✓ Was called | var vowFs = require('vow-fs'function() {··· deferred.resolve(stdinHandler(stdInput.join(''))); }); |
| Function (anonymous_30) | |
|---|---|
| ✓ Was called | var vowFs = require('vow-fs');··· var Vow = function(testPath) { var extension = path.extname(testPath).toLowerCase(); var basename = path.basename(testPath).toLowerCase(); return !( this._fileExtensions.indexOf(extension) < 0 && this._fileExtensions.indexOf(basename) < 0 && this._fileExtensions.indexOf('*') < 0 ); }; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var vowFthis._fileExtensions.indexOf('*') < 0 |
| ✓ Was returned | var vowFthis._fileExtensions.indexOf(extension) < 0 &&··· this._fileExtensions.indexOf(basename) < 0 && |
| Branch LogicalExpression | |
| ✓ Was returned | var vowFthis._fileExtensions.indexOf(basename) < 0 && |
| ✓ Was returned | var vowFthis._fileExtensions.indexOf(extension) < 0 && |
| Function (anonymous_31) | |
|---|---|
| ✓ Was called | var vowFs = require('vow-fs');··· var Vow = function() { return new NodeConfiguration(); }; |
| Function getInternalErrorMessage | |
|---|---|
| ✓ Was called | function getInternalErrorMessage(rule, e) {··· return 'Error running rule ' + rule + ': ' + 'This is an issue with JSCS and not your codebase.\n' + 'Please file an issue (with the stack trace below) at: ' + 'https://github.com/jscs-dev/node-jscs/issues/new\n' + e; } |
| Function (anonymous_33) | |
|---|---|
| ✓ Was called | var esprima = requirfunction() {··· this._configuredRules = []; this._errorsFound = 0; this._maxErrorsExceeded = false; // Need to be defined here because Configuration module can choose // custom esprima or chose parsers based on "esnext" option this._esprima = esprima; this._configuration = this._createConfiguration(); this._configuration.registerDefaultPresets(); }; |
| Function (anonymous_34) | |
|---|---|
| ✓ Was called | var esprima = requfunction(rule) {··· this._configuration.registerRule(rule); }, |
| Function (anonymous_35) | |
|---|---|
| ✓ Was called | var esprima = require('espfunction() {··· this._configuration.registerDefaultRules(); }, |
| Function (anonymous_36) | |
|---|---|
| ✗ Was not called | var esprima = require('efunction() {··· return this._configuration.getProcessedConfig(); }, |
| Function (anonymous_37) | |
|---|---|
| ✓ Was called | var esprima = rfunction(config) {··· this._configuration.load(config); if (this._configuration.hasCustomEsprima()) { this._esprima = this._configuration.getCustomEsprima(); } else if (this._configuration.isESNextEnabled()) { this._esprima = babelJscs; } this._verbose = this._configuration.getVerbose(); this._configuredRules = this._configuration.getConfiguredRules(); this._maxErrors = this._configuration.getMaxErrors(); }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var esprima = require('esprima');··· var babelJscs = re{ this._esprima = this._configuration.getCustomEsprima(); } else if (this._configuration.isESNextEnabled()) { |
| ✓ Negative was executed (else) | var esprima = rif (this._configuration.isESNextEnabled()) {··· this._esprima = babelJscs; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var esprima = require('esprima');··· var babelJscs = require({ this._esprima = babelJscs; } |
| ✓ Negative was executed (else) | var espri··· this._verbose = this._configuration.getVerbose(); |
| Function (anonymous_38) | |
|---|---|
| ✓ Was called | var esprima = reqfunction(source, filename) {··· filename = filename || 'input'; var file = this._createJsFileInstance(filename, source); var errors = new Errors(file, this._verbose); file.getParseErrors().forEach(function(parseError) { if (!this._maxErrorsExceeded) { this._addParseError(errors, parseError); } }, this); // Do not check empty strings if (file.getFirstToken({includeComments: true}).type === 'EOF') { return errors; } this._checkJsFile(file, errors); return errors; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var esprima = require('esprima''input'; |
| ✓ Was returned | var esprima = requifilename || 'input'; |
| Function (anonymous_39) | |
|---|---|
| ✓ Was called | var esprima = require('esprima');··· var function(parseError) { if (!this._maxErrorsExceeded) { this._addParseError(errors, parseError); } }, this); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var esprima = require('esprima');··· var babe{ this._addParseError(errors, parseError); } |
| ✗ Negative was not executed (else) | var esprima =··· }, this); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var esprima = require('esprima');··· var babelJscs = require('babel-jscs');{ return errors; } |
| ✓ Negative was executed (else) | var espri··· this._checkJsFile(file, errors); |
| Function (anonymous_40) | |
|---|---|
| ✓ Was called | var esprima = refunction(file, errors) {··· var list = errors.getErrorList(); var configuration = this.getConfiguration(); list.forEach(function(error) { if (error.fixed) { return; } var instance = configuration.getConfiguredRule(error.rule); if (instance && instance._fix) { try { // "error.fixed = true" should go first, so rule can // decide for itself (with "error.fixed = false") // if it can fix this particular error error.fixed = true; instance._fix(file, error); } catch (e) { error.fixed = undefined; errors.add(getInternalErrorMessage(error.rule, e), 1, 0); } } }); }, |
| Function (anonymous_41) | |
|---|---|
| ✓ Was called | var esprima = requirefunction(error) {··· if (error.fixed) { return; } var instance = configuration.getConfiguredRule(error.rule); if (instance && instance._fix) { try { // "error.fixed = true" should go first, so rule can // decide for itself (with "error.fixed = false") // if it can fix this particular error error.fixed = true; instance._fix(file, error); } catch (e) { error.fixed = undefined; errors.add(getInternalErrorMessage(error.rule, e), 1, 0); } } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var esprima = require('esprim{··· return; } |
| ✓ Negative was executed (else) | var esprima =··· var instance = configuration.getConfiguredRule(error.rule); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var esprima = require('esprima');··· var babel{ try { // "error.fixed = true" should go first, so rule can // decide for itself (with "error.fixed = false") // if it can fix this particular error error.fixed = true; instance._fix(file, error); } catch (e) { error.fixed = undefined; errors.add(getInternalErrorMessage(error.rule, e), 1, 0); } } |
| ✓ Negative was executed (else) | var esprima =··· }); |
| Branch LogicalExpression | |
| ✓ Was returned | var esprima = require('espriinstance._fix) { |
| ✗ Was not returned | var esprima = reinstance && instance._fix) { |
| Function (anonymous_42) | |
|---|---|
| ✓ Was called | var esprima = requfunction(file, errors) {··· if (this._maxErrorsExceeded) { return; } var errorFilter = this._configuration.getErrorFilter(); this._configuredRules.forEach(function(rule) { errors.setCurrentRule(rule.getOptionName()); try { rule.check(file, errors); } catch (e) { errors.setCurrentRule('internalError'); errors.add(getInternalErrorMessage(rule.getOptionName(), e.stack), 1, 0); } }, this); this._configuration.getUnsupportedRuleNames().forEach(function(rulename) { errors.add('Unsupported rule: ' + rulename, 1, 0); }); // sort errors list to show errors as they appear in source errors.getErrorList().sort(function(a, b) { return (a.line - b.line) || (a.column - b.column); }); if (errorFilter) { errors.filter(errorFilter); } if (this.maxErrorsEnabled()) { if (this._maxErrors === -1 || this._maxErrors === null) { this._maxErrorsExceeded = false; } else { this._maxErrorsExceeded = this._errorsFound + errors.getErrorCount() > this._maxErrors; errors.stripErrorList(Math.max(0, this._maxErrors - this._errorsFound)); } } this._errorsFound += errors.getErrorCount(); }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var esprima = require('esprima');··· var{ return; } |
| ✓ Negative was executed (else) | var espri··· var errorFilter = this._configuration.getErrorFilter(); |
| Function (anonymous_43) | |
|---|---|
| ✓ Was called | var esprima = require('esprima');··· var function(rule) { errors.setCurrentRule(rule.getOptionName()); try { rule.check(file, errors); } catch (e) { errors.setCurrentRule('internalError'); errors.add(getInternalErrorMessage(rule.getOptionName(), e.stack), 1, 0); } }, this); |
| Function (anonymous_44) | |
|---|---|
| ✓ Was called | var esprima = require('esprima');··· var babelJscs = require('babfunction(rulename) { errors.add('Unsupported rule: ' + rulename, 1, 0); }); |
| Function (anonymous_45) | |
|---|---|
| ✓ Was called | var esprima = require('esprima');··· vfunction(a, b) { return (a.line - b.line) || (a.column - b.column); }); |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var esprima = require('esprima');··· var baba.column - b.column); |
| ✓ Was returned | var esprima = requira.line - b.line) || (a.column - b.column); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var esprima = require('es{··· errors.filter(errorFilter); } |
| ✓ Negative was executed (else) | var espri··· if (this.maxErrorsEnabled()) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var esprima = require('esprima');··· var{ if (this._maxErrors === -1 || this._maxErrors === null) { this._maxErrorsExceeded = false; } else { this._maxErrorsExceeded = this._errorsFound + errors.getErrorCount() > this._maxErrors; errors.stripErrorList(Math.max(0, this._maxErrors - this._errorsFound)); } } |
| ✓ Negative was executed (else) | var espri··· this._errorsFound += errors.getErrorCount(); |
| Branch IfStatement | |
|---|---|
| ✗ Positive was not executed (if) | var esprima = require('esprima');··· var babelJscs = require('babel-jsc{ this._maxErrorsExceeded = false; } else { |
| ✓ Negative was executed (else) | var esprima = requi{··· this._maxErrorsExceeded = this._errorsFound + errors.getErrorCount() > this._maxErrors; errors.stripErrorList(Math.max(0, this._maxErrors - this._errorsFound)); } |
| Branch LogicalExpression | |
| ✓ Was returned | var esprima = require('esprima');··· var babethis._maxErrors === null) { |
| ✗ Was not returned | var esprima = rethis._maxErrors === -1 || this._maxErrors === null) { |
| Function (anonymous_46) | |
|---|---|
| ✓ Was called | var esprima = requirfunction(errors, parseError) {··· if (this._maxErrorsExceeded) { return; } errors.setCurrentRule('parseError'); errors.add(parseError.description, parseError.lineNumber, parseError.column); if (this.maxErrorsEnabled()) { this._errorsFound += 1; this._maxErrorsExceeded = this._errorsFound >= this._maxErrors; } }, |
| Branch IfStatement | |
|---|---|
| ✗ Positive was not executed (if) | var esprima = require('esprima');··· var{ return; } |
| ✓ Negative was executed (else) | var espri··· errors.setCurrentRule('parseError'); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var esprima = require('esprima');··· var{ this._errorsFound += 1; this._maxErrorsExceeded = this._errorsFound >= this._maxErrors; } |
| ✗ Negative was not executed (else) | var espri··· }, |
| Function (anonymous_47) | |
|---|---|
| ✓ Was called | var esprima = require('esprfunction(filename, source) {··· return new JsFile({ filename: filename, source: source, esprima: this._esprima, esprimaOptions: this._configuration.getEsprimaOptions(), es3: this._configuration.isES3Enabled(), es6: this._configuration.isESNextEnabled() }); }, |
| Function (anonymous_48) | |
|---|---|
| ✓ Was called | var esprima = rfunction(source, filename) {··· filename = filename || 'input'; var file = this._createJsFileInstance(filename, source); var errors = new Errors(file, this._verbose); var parseErrors = file.getParseErrors(); if (parseErrors.length > 0) { parseErrors.forEach(function(parseError) { this._addParseError(errors, parseError); }, this); return {output: source, errors: errors}; } else { var attempt = 0; do { // Changes to current sources are made in rules through assertions. this._checkJsFile(file, errors); // If assertions weren't used but rule has "fix" method, // which we could use. this._fixJsFile(file, errors); var hasFixes = errors.getErrorList().some(function(err) { return err.fixed; }); if (!hasFixes) { break; } file = this._createJsFileInstance(filename, file.render()); errors = new Errors(file, this._verbose); attempt++; } while (attempt < MAX_FIX_ATTEMPTS); return {output: file.getSource(), errors: errors}; } }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var esprima = require('esprima''input'; |
| ✓ Was returned | var esprima = requifilename || 'input'; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var esprima = require('esprima');··· va{ parseErrors.forEach(function(parseError) { this._addParseError(errors, parseError); }, this); return {output: source, errors: errors}; } else { |
| ✓ Negative was executed (else) | var esprima = r{··· var attempt = 0; do { // Changes to current sources are made in rules through assertions. this._checkJsFile(file, errors); // If assertions weren't used but rule has "fix" method, // which we could use. this._fixJsFile(file, errors); var hasFixes = errors.getErrorList().some(function(err) { return err.fixed; }); if (!hasFixes) { break; } file = this._createJsFileInstance(filename, file.render()); errors = new Errors(file, this._verbose); attempt++; } while (attempt < MAX_FIX_ATTEMPTS); return {output: file.getSource(), errors: errors}; } |
| Function (anonymous_49) | |
|---|---|
| ✓ Was called | var esprima = require('esprima')function(parseError) {··· this._addParseError(errors, parseError); }, this); |
| Function (anonymous_50) | |
|---|---|
| ✓ Was called | var esprima = require('esprima');··· var babelJscs = require(function(err) { return err.fixed; }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var esprima = require('esprima'{··· break; } |
| ✓ Negative was executed (else) | var esprima = req··· file = this._createJsFileInstance(filename, file.render()); |
| Function (anonymous_51) | |
|---|---|
| ✓ Was called | var esprima = require(function() {··· return this._maxErrors !== null && this._maxErrors !== -1; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var esprima = require('esprima');··· var babelthis._maxErrors !== -1; |
| ✓ Was returned | var esprima = rthis._maxErrors !== null && this._maxErrors !== -1; |
| Function (anonymous_52) | |
|---|---|
| ✓ Was called | var esprima = require('function() {··· return this._maxErrorsExceeded; }, |
| Function (anonymous_53) | |
|---|---|
| ✓ Was called | var esprima = require('espfunction() {··· return new Configuration(); }, |
| Function (anonymous_54) | |
|---|---|
| ✓ Was called | var esprima = require(function() {··· return this._configuration; }, |
| Function (anonymous_55) | |
|---|---|
| ✓ Was called | var esprima = refunction() {··· return this._esprima || this._configuration.getCustomEsprima(); } |
| Branch LogicalExpression | |
|---|---|
| ✗ Was not returned | var esprima = require('esprima')this._configuration.getCustomEsprima(); |
| ✓ Was returned | var esprima = rthis._esprima || this._configuration.getCustomEsprima(); |
| Function (anonymous_56) | |
|---|---|
| ✓ Was called | var assert = function(file, verbose) {··· this._errorList = []; this._file = file; this._currentRule = ''; this._verbose = verbose || false; /** * @type {TokenAssert} * @public */ this.assert = new TokenAssert(file); this.assert.on('error', this._addError.bind(this)); }; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var assert = require('assert');false; |
| ✓ Was returned | var assert = requireverbose || false; |
| Function (anonymous_57) | |
|---|---|
| ✓ Was called | var asserfunction(message, line, column) {··· if (typeof line === 'object') { column = line.column; line = line.line; } var errorInfo = { message: message, line: line, column: column }; this._validateInput(errorInfo); this._addError(errorInfo); }, |
| Branch IfStatement | |
|---|---|
| ✗ Positive was not executed (if) | var assert = require('assert');··· var ch{ column = line.column; line = line.line; } |
| ✓ Negative was executed (else) | var asser··· var errorInfo = { |
| Function (anonymous_58) | |
|---|---|
| ✓ Was called | var assertfunction(errorInfo) {··· var additional = errorInfo.additional; assert(typeof additional !== undefined, '`additional` argument should not be empty'); this._addError(errorInfo); }, |
| Function (anonymous_59) | |
|---|---|
| ✓ Was called | var assert = requirefunction(errorInfo) {··· var line = errorInfo.line; var column = errorInfo.column; // line and column numbers should be explicit assert(typeof line === 'number' && line > 0, 'Unable to add an error, `line` should be a number greater than 0 but ' + line + ' given'); assert(typeof column === 'number' && column >= 0, 'Unable to add an error, `column` should be a positive number but ' + column + ' given'); }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var assert = require('assert');··· var chalk =line > 0, |
| ✓ Was returned | var assert = retypeof line === 'number' && line > 0, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var assert = require('assert');··· var chalk = rcolumn >= 0, |
| ✓ Was returned | var assert = retypeof column === 'number' && column >= 0, |
| Function (anonymous_60) | |
|---|---|
| ✓ Was called | var assert = refunction(errorInfo) {··· if (!this._file.isEnabledRule(this._currentRule, errorInfo.line)) { return; } this._validateInput(errorInfo); this._errorList.push({ filename: this._file.getFilename(), rule: this._currentRule, message: this._prepareMessage(errorInfo), line: errorInfo.line, column: errorInfo.column, additional: errorInfo.additional, fixed: errorInfo.fixed }); }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var chalk = require('chalk'); var TokenAss{ return; } |
| ✓ Negative was executed (else) | var asser··· this._validateInput(errorInfo); |
| Function (anonymous_61) | |
|---|---|
| ✓ Was called | var assert = require(function(errorInfo) {··· if (this._verbose && this._currentRule) { return this._currentRule + ': ' + errorInfo.message; } return errorInfo.message; }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var chalk = requ{ return this._currentRule + ': ' + errorInfo.message; } |
| ✓ Negative was executed (else) | var asser··· return errorInfo.message; |
| Branch LogicalExpression | |
| ✓ Was returned | var assert = require('assert'this._currentRule) { |
| ✓ Was returned | var assert =this._verbose && this._currentRule) { |
| Function (anonymous_62) | |
|---|---|
| ✓ Was called | var assert = requifunction() {··· return this._errorList; }, |
| Function (anonymous_63) | |
|---|---|
| ✓ Was called | var assert = requfunction() {··· return this._file.getFilename(); }, |
| Function (anonymous_64) | |
|---|---|
| ✗ Was not called | var assert = function() {··· return this._errorList.length === 0; }, |
| Function (anonymous_65) | |
|---|---|
| ✓ Was called | var assert = requirfunction() {··· return this._errorList.length; }, |
| Function (anonymous_66) | |
|---|---|
| ✓ Was called | var assert = requirefunction(length) {··· this._errorList.splice(length); }, |
| Function (anonymous_67) | |
|---|---|
| ✓ Was called | var assert =function(filter) {··· this._errorList = this._errorList.filter(filter); }, |
| Function (anonymous_68) | |
|---|---|
| ✓ Was called | var assert = requifunction(error, colorize) {··· var lineNumber = error.line - 1; var lines = this._file.getLines(); var result = [ renderLine(lineNumber, lines[lineNumber], colorize), renderPointer(error.column, colorize) ]; var i = lineNumber - 1; var linesAround = 2; while (i >= 0 && i >= (lineNumber - linesAround)) { result.unshift(renderLine(i, lines[i], colorize)); i--; } i = lineNumber + 1; while (i < lines.length && i <= (lineNumber + linesAround)) { result.push(renderLine(i, lines[i], colorize)); i++; } result.unshift(formatErrorMessage(error.message, this.getFilename(), colorize)); return result.join('\n'); }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var assert = require('assi >= (lineNumber - linesAround)) { |
| ✓ Was returned | var assert = rei >= 0 && i >= (lineNumber - linesAround)) { |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var assert = require('assert');··· vari <= (lineNumber + linesAround)) { |
| ✓ Was returned | var assert = rei < lines.length && i <= (lineNumber + linesAround)) { |
| Function (anonymous_69) | |
|---|---|
| ✓ Was called | var assert = requirefunction(rule) {··· this._currentRule = rule; } |
| Function formatErrorMessage | |
|---|---|
| ✓ Was called | function formatErrorMessage(message, filename, colorize) {··· return (colorize ? chalk.bold(message) : message) + ' at ' + (colorize ? chalk.green(filename) : filename) + ' :'; } |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | var assert = require('achalk.bold(message) : message) + |
| ✓ Negative was returned (: ...) | var assert = require('assert');··· var chalk = rmessage) + |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | var assert = requirechalk.green(filename) : filename) + ' :'; |
| ✓ Negative was returned (: ...) | var assert = require('assert');··· var chalk = filename) + ' :'; |
| Function prependSpaces | |
|---|---|
| ✓ Was called | function prependSpaces(s, len) {··· while (s.length < len) { s = ' ' + s; } return s; } |
| Function renderLine | |
|---|---|
| ✓ Was called | function renderLine(n, line, colorize) {··· // Convert tabs to spaces, so errors in code lines with tabs as indention symbol // could be correctly rendered, plus it will provide less verbose output line = line.replace(/\t/g, ' '); // "n + 1" to print lines in human way (counted from 1) var lineNumber = prependSpaces((n + 1).toString(), 5) + ' |'; return ' ' + (colorize ? chalk.grey(lineNumber) : lineNumber) + line; } |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | var assert = require('assert'chalk.grey(lineNumber) : lineNumber) + line; |
| ✓ Negative was returned (: ...) | var assert = require('assert');··· var chalk = require('clineNumber) + line; |
| Function renderPointer | |
|---|---|
| ✓ Was called | function renderPointer(column, colorize) {··· var res = (new Array(column + 9)).join('-') + '^'; return colorize ? chalk.grey(res) : res; } |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | var assert = require('chalk.grey(res) : res; |
| ✓ Negative was returned (: ...) | var assert = require('assert');··· var chalres; |
| Function TokenAssert | |
|---|---|
| ✓ Was called | function TokenAssert(file) {··· EventEmitter.call(this); this._file = file; } |
| Function (anonymous_75) | |
|---|---|
| ✓ Was called | var utils = require('util');··· var EventEmitfunction(options) { options.atLeast = 1; this.spacesBetween(options); }; |
| Function (anonymous_76) | |
|---|---|
| ✓ Was called | var utils = require('util');··· var EventEmittefunction(options) { options.exactly = 0; this.spacesBetween(options); }; |
| Function (anonymous_77) | |
|---|---|
| ✓ Was called | var utils = require('util');··· var Eventfunction(options) { var token = options.token; var nextToken = options.nextToken; var atLeast = options.atLeast; var atMost = options.atMost; var exactly = options.exactly; if (!token || !nextToken) { return; } this._validateOptions(options); if (!options.disallowNewLine && token.loc.end.line !== nextToken.loc.start.line) { return; } // Only attempt to remove or add lines if there are no comments between the two nodes // as this prevents accidentally moving a valid token onto a line comment ed line var fixed = this._file.getNextToken(options.token, { includeComments: true }) === nextToken; var emitError = function(countPrefix, spaceCount) { if (fixed) { this._file.setWhitespaceBefore(nextToken, new Array(spaceCount + 1).join(' ')); } var msgPostfix = token.value + ' and ' + nextToken.value; if (!options.message) { if (exactly === 0) { // support noWhitespaceBetween options.message = 'Unexpected whitespace between ' + msgPostfix; } else if (exactly !== undefined) { // support whitespaceBetween (spaces option) options.message = spaceCount + ' spaces required between ' + msgPostfix; } else if (atLeast === 1 && atMost === undefined) { // support whitespaceBetween (no spaces option) options.message = 'Missing space between ' + msgPostfix; } else { options.message = countPrefix + ' ' + spaceCount + ' spaces required between ' + msgPostfix; } } this.emit('error', { message: options.message, line: token.loc.end.line, column: token.loc.end.column, fixed: fixed }); }.bind(this); var spacesBetween = Math.abs(nextToken.range[0] - token.range[1]); if (atLeast !== undefined && spacesBetween < atLeast) { emitError('at least', atLeast); } else if (atMost !== undefined && spacesBetween > atMost) { emitError('at most', atMost); } else if (exactly !== undefined && spacesBetween !== exactly) { emitError('exactly', exactly); } }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var utils = require('util');··· v{ return; } |
| ✓ Negative was executed (else) | var u··· this._validateOptions(options); |
| Branch LogicalExpression | |
| ✓ Was returned | var utils = requir!nextToken) { |
| ✓ Was returned | var util!token || !nextToken) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var utils = require('util');··· var EventEmitter = require('events').EventEmitter; /** { return; } |
| ✓ Negative was executed (else) | var u··· // Only attempt to remove or add lines if there are no comments between the two nodes |
| Branch LogicalExpression | |
| ✓ Was returned | var utils = require('util');··· var Evetoken.loc.end.line !== nextToken.loc.start.line) { |
| ✓ Was returned | var util!options.disallowNewLine && token.loc.end.line !== nextToken.loc.start.line) { |
| Function (anonymous_78) | |
|---|---|
| ✓ Was called | var utils = require(function(countPrefix, spaceCount) {··· if (fixed) { this._file.setWhitespaceBefore(nextToken, new Array(spaceCount + 1).join(' ')); } var msgPostfix = token.value + ' and ' + nextToken.value; if (!options.message) { if (exactly === 0) { // support noWhitespaceBetween options.message = 'Unexpected whitespace between ' + msgPostfix; } else if (exactly !== undefined) { // support whitespaceBetween (spaces option) options.message = spaceCount + ' spaces required between ' + msgPostfix; } else if (atLeast === 1 && atMost === undefined) { // support whitespaceBetween (no spaces option) options.message = 'Missing space between ' + msgPostfix; } else { options.message = countPrefix + ' ' + spaceCount + ' spaces required between ' + msgPostfix; } } this.emit('error', { message: options.message, line: token.loc.end.line, column: token.loc.end.column, fixed: fixed }); }.bind(this); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var utils = require{··· this._file.setWhitespaceBefore(nextToken, new Array(spaceCount + 1).join(' ')); } |
| ✓ Negative was executed (else) | var utils··· var msgPostfix = token.value + ' and ' + nextToken.value; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var utils = require('util');··· v{ if (exactly === 0) { // support noWhitespaceBetween options.message = 'Unexpected whitespace between ' + msgPostfix; } else if (exactly !== undefined) { // support whitespaceBetween (spaces option) options.message = spaceCount + ' spaces required between ' + msgPostfix; } else if (atLeast === 1 && atMost === undefined) { // support whitespaceBetween (no spaces option) options.message = 'Missing space between ' + msgPostfix; } else { options.message = countPrefix + ' ' + spaceCount + ' spaces required between ' + msgPostfix; } } |
| ✓ Negative was executed (else) | var utils··· this.emit('error', { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var utils = require('util');··· va{ // support noWhitespaceBetween options.message = 'Unexpected whitespace between ' + msgPostfix; } else if (exactly !== undefined) { |
| ✓ Negative was executed (else) | var utils = requireif (exactly !== undefined) {··· // support whitespaceBetween (spaces option) options.message = spaceCount + ' spaces required between ' + msgPostfix; } else if (atLeast === 1 && atMost === undefined) { // support whitespaceBetween (no spaces option) options.message = 'Missing space between ' + msgPostfix; } else { options.message = countPrefix + ' ' + spaceCount + ' spaces required between ' + msgPostfix; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var utils = require('util');··· var EventEmitter { // support whitespaceBetween (spaces option) options.message = spaceCount + ' spaces required between ' + msgPostfix; } else if (atLeast === 1 && atMost === undefined) { |
| ✓ Negative was executed (else) | var utils = requireif (atLeast === 1 && atMost === undefined) {··· // support whitespaceBetween (no spaces option) options.message = 'Missing space between ' + msgPostfix; } else { options.message = countPrefix + ' ' + spaceCount + ' spaces required between ' + msgPostfix; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var utils = require('util');··· var EventEmitter = require('event{ // support whitespaceBetween (no spaces option) options.message = 'Missing space between ' + msgPostfix; } else { |
| ✓ Negative was executed (else) | var utils = require{··· options.message = countPrefix + ' ' + spaceCount + ' spaces required between ' + msgPostfix; } |
| Branch LogicalExpression | |
| ✓ Was returned | var utils = require('util');··· var EventEmatMost === undefined) { |
| ✓ Was returned | var utils = require('utatLeast === 1 && atMost === undefined) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var utils = require('util');··· var EventEmitter = require('e{ emitError('at least', atLeast); } else if (atMost !== undefined && spacesBetween > atMost) { |
| ✓ Negative was executed (else) | var utils =if (atMost !== undefined && spacesBetween > atMost) {··· emitError('at most', atMost); } else if (exactly !== undefined && spacesBetween !== exactly) { emitError('exactly', exactly); } |
| Branch LogicalExpression | |
| ✓ Was returned | var utils = require('util');··· var spacesBetween < atLeast) { |
| ✓ Was returned | var utilatLeast !== undefined && spacesBetween < atLeast) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var utils = require('util');··· var EventEmitter = require('events{ emitError('at most', atMost); } else if (exactly !== undefined && spacesBetween !== exactly) { |
| ✓ Negative was executed (else) | var utils =if (exactly !== undefined && spacesBetween !== exactly) {··· emitError('exactly', exactly); } |
| Branch LogicalExpression | |
| ✓ Was returned | var utils = require('util');··· var EventEspacesBetween > atMost) { |
| ✓ Was returned | var utils = reqatMost !== undefined && spacesBetween > atMost) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var utils = require('util');··· var EventEmitter = require('events').E{ emitError('exactly', exactly); } |
| ✓ Negative was executed (else) | var u··· }; |
| Branch LogicalExpression | |
| ✓ Was returned | var utils = require('util');··· var EventEmspacesBetween !== exactly) { |
| ✓ Was returned | var utils = reqexactly !== undefined && spacesBetween !== exactly) { |
| Function (anonymous_79) | |
|---|---|
| ✓ Was called | var utils = require('util');··· var Evefunction(options) { var lineNumber = options.lineNumber; var actual = options.actual; var expected = options.expected; var indentChar = options.indentChar; if (actual === expected) { return; } if (!options.silent) { this.emit('error', { message: 'Expected indentation of ' + expected + ' characters', line: lineNumber, column: expected, fixed: true }); } var token = this._file.getFirstTokenOnLine(lineNumber, { includeComments: true }); var newWhitespace = (new Array(expected + 1)).join(indentChar); if (!token) { this._setEmptyLineIndentation(lineNumber, newWhitespace); return; } this._updateWhitespaceByLine(token, function(lines) { lines[lines.length - 1] = newWhitespace; return lines; }); if (token.isComment) { this._updateCommentWhitespace(token, indentChar, actual, expected); } }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var utils = require('util');··· { return; } |
| ✓ Negative was executed (else) | var u··· if (!options.silent) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var utils = require('util{··· this.emit('error', { message: 'Expected indentation of ' + expected + ' characters', line: lineNumber, column: expected, fixed: true }); } |
| ✓ Negative was executed (else) | var u··· var token = this._file.getFirstTokenOnLine(lineNumber, { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var utils = requ{··· this._setEmptyLineIndentation(lineNumber, newWhitespace); return; } |
| ✓ Negative was executed (else) | var u··· this._updateWhitespaceByLine(token, function(lines) { |
| Function (anonymous_80) | |
|---|---|
| ✓ Was called | var utils = require('util');··· var EventEmfunction(lines) { lines[lines.length - 1] = newWhitespace; return lines; }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var utils = require('util{··· this._updateCommentWhitespace(token, indentChar, actual, expected); } |
| ✓ Negative was executed (else) | var u··· }; |
| Function (anonymous_81) | |
|---|---|
| ✓ Was called | var utils = require('util');··· var EventEmitter = function(token, callback) { var lineBreak = this._file.getLineBreakStyle(); var lines = this._file.getWhitespaceBefore(token).split(/\r\n|\r|\n/); lines = callback(lines); this._file.setWhitespaceBefore(token, lines.join(lineBreak)); }; |
| Function (anonymous_82) | |
|---|---|
| ✓ Was called | var utils = require('util');··· var EventEmitter = rfunction(token, indentChar, actual, expected) { var difference = expected - actual; var tokenLines = token.value.split(/\r\n|\r|\n/); var i = 1; if (difference >= 0) { var lineWhitespace = (new Array(difference + 1)).join(indentChar); for (; i < tokenLines.length; i++) { tokenLines[i] = tokenLines[i] === '' ? '' : lineWhitespace + tokenLines[i]; } } else { for (; i < tokenLines.length; i++) { tokenLines[i] = tokenLines[i].substring(-difference); } } token.value = tokenLines.join(this._file.getLineBreakStyle()); }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var utils = require('util{··· var lineWhitespace = (new Array(difference + 1)).join(indentChar); for (; i < tokenLines.length; i++) { tokenLines[i] = tokenLines[i] === '' ? '' : lineWhitespace + tokenLines[i]; } } else { |
| ✓ Negative was executed (else) | var utils ={··· for (; i < tokenLines.length; i++) { tokenLines[i] = tokenLines[i].substring(-difference); } } |
| Branch ConditionalExpression | |
|---|---|
| ✗ Positive was not returned (? ...) | var utils = require('util');··· var EventEmitter = req'' : lineWhitespace + tokenLines[i]; |
| ✓ Negative was returned (: ...) | var utils = require('util');··· var EventEmitter = require(lineWhitespace + tokenLines[i]; |
| Function (anonymous_83) | |
|---|---|
| ✓ Was called | var utils = require('util');··· var EventEmitter = rfunction(lineNumber, newWhitespace) { var token; do { token = this._file.getFirstTokenOnLine(++lineNumber, { includeComments: true }); } while (!token); this._updateWhitespaceByLine(token, function(lines) { if (lines[0] !== '') { lines[0] = newWhitespace; } for (var i = 1; i < lines.length; i++) { lines[i] = newWhitespace; } return lines; }); }; |
| Function (anonymous_84) | |
|---|---|
| ✓ Was called | var utils = require('util');··· var EventEmfunction(lines) { if (lines[0] !== '') { lines[0] = newWhitespace; } for (var i = 1; i < lines.length; i++) { lines[i] = newWhitespace; } return lines; }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var utils = require('util');··· { lines[0] = newWhitespace; } |
| ✓ Negative was executed (else) | var utils··· for (var i = 1; i < lines.length; i++) { |
| Function (anonymous_85) | |
|---|---|
| ✓ Was called | var utils = require('util');··· var function(options) { options.exactly = 0; this.linesBetween(options); }; |
| Function (anonymous_86) | |
|---|---|
| ✓ Was called | var utils = require('util');··· var Eventfunction(options) { options.atLeast = 1; this.linesBetween(options); }; |
| Function (anonymous_87) | |
|---|---|
| ✓ Was called | var utils = require('util');··· var Evenfunction(options) { var token = options.token; var nextToken = options.nextToken; var atLeast = options.atLeast; var atMost = options.atMost; var exactly = options.exactly; if (!token || !nextToken) { return; } this._validateOptions(options); // Only attempt to remove or add lines if there are no comments between the two nodes // as this prevents accidentally moving a valid token onto a line comment ed line var fixed = this._file.getNextToken(options.token, { includeComments: true }) === nextToken; var linesBetween = Math.abs(token.loc.end.line - nextToken.loc.start.line); var emitError = function(countPrefix, lineCount) { var msgPrefix = token.value + ' and ' + nextToken.value; if (!options.message) { if (exactly === 0) { // support sameLine options.message = msgPrefix + ' should be on the same line'; } else if (atLeast === 1 && atMost === undefined) { // support differentLine options.message = msgPrefix + ' should be on different lines'; } else { // support linesBetween options.message = msgPrefix + ' should have ' + countPrefix + ' ' + lineCount + ' line(s) between them'; } } if (fixed) { this._augmentLineCount(options, lineCount); } this.emit('error', { message: options.message, line: token.loc.end.line, column: token.loc.end.column, fixed: fixed }); }.bind(this); if (atLeast !== undefined && linesBetween < atLeast) { emitError('at least', atLeast); } else if (atMost !== undefined && linesBetween > atMost) { emitError('at most', atMost); } else if (exactly !== undefined && linesBetween !== exactly) { emitError('exactly', exactly); } }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var utils = require('util');··· v{ return; } |
| ✓ Negative was executed (else) | var u··· this._validateOptions(options); |
| Branch LogicalExpression | |
| ✓ Was returned | var utils = requir!nextToken) { |
| ✓ Was returned | var util!token || !nextToken) { |
| Function (anonymous_88) | |
|---|---|
| ✓ Was called | var utils = require(function(countPrefix, lineCount) {··· var msgPrefix = token.value + ' and ' + nextToken.value; if (!options.message) { if (exactly === 0) { // support sameLine options.message = msgPrefix + ' should be on the same line'; } else if (atLeast === 1 && atMost === undefined) { // support differentLine options.message = msgPrefix + ' should be on different lines'; } else { // support linesBetween options.message = msgPrefix + ' should have ' + countPrefix + ' ' + lineCount + ' line(s) between them'; } } if (fixed) { this._augmentLineCount(options, lineCount); } this.emit('error', { message: options.message, line: token.loc.end.line, column: token.loc.end.column, fixed: fixed }); }.bind(this); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var utils = require('util');··· v{ if (exactly === 0) { // support sameLine options.message = msgPrefix + ' should be on the same line'; } else if (atLeast === 1 && atMost === undefined) { // support differentLine options.message = msgPrefix + ' should be on different lines'; } else { // support linesBetween options.message = msgPrefix + ' should have ' + countPrefix + ' ' + lineCount + ' line(s) between them'; } } |
| ✓ Negative was executed (else) | var utils··· if (fixed) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var utils = require('util');··· va{ // support sameLine options.message = msgPrefix + ' should be on the same line'; } else if (atLeast === 1 && atMost === undefined) { |
| ✓ Negative was executed (else) | var utils = requireif (atLeast === 1 && atMost === undefined) {··· // support differentLine options.message = msgPrefix + ' should be on different lines'; } else { // support linesBetween options.message = msgPrefix + ' should have ' + countPrefix + ' ' + lineCount + ' line(s) between them'; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var utils = require('util');··· var EventEmitter = require('event{ // support differentLine options.message = msgPrefix + ' should be on different lines'; } else { |
| ✓ Negative was executed (else) | var utils = require{··· // support linesBetween options.message = msgPrefix + ' should have ' + countPrefix + ' ' + lineCount + ' line(s) between them'; } |
| Branch LogicalExpression | |
| ✓ Was returned | var utils = require('util');··· var EventEmatMost === undefined) { |
| ✓ Was returned | var utils = require('utatLeast === 1 && atMost === undefined) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var utils = require{··· this._augmentLineCount(options, lineCount); } |
| ✓ Negative was executed (else) | var utils··· this.emit('error', { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var utils = require('util');··· var EventEmitter = require('{ emitError('at least', atLeast); } else if (atMost !== undefined && linesBetween > atMost) { |
| ✓ Negative was executed (else) | var utils =if (atMost !== undefined && linesBetween > atMost) {··· emitError('at most', atMost); } else if (exactly !== undefined && linesBetween !== exactly) { emitError('exactly', exactly); } |
| Branch LogicalExpression | |
| ✓ Was returned | var utils = require('util');··· var linesBetween < atLeast) { |
| ✓ Was returned | var utilatLeast !== undefined && linesBetween < atLeast) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var utils = require('util');··· var EventEmitter = require('event{ emitError('at most', atMost); } else if (exactly !== undefined && linesBetween !== exactly) { |
| ✓ Negative was executed (else) | var utils =if (exactly !== undefined && linesBetween !== exactly) {··· emitError('exactly', exactly); } |
| Branch LogicalExpression | |
| ✓ Was returned | var utils = require('util');··· var EventElinesBetween > atMost) { |
| ✓ Was returned | var utils = reqatMost !== undefined && linesBetween > atMost) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var utils = require('util');··· var EventEmitter = require('events').{ emitError('exactly', exactly); } |
| ✓ Negative was executed (else) | var u··· }; |
| Branch LogicalExpression | |
| ✓ Was returned | var utils = require('util');··· var EventEmlinesBetween !== exactly) { |
| ✓ Was returned | var utils = reqexactly !== undefined && linesBetween !== exactly) { |
| Function (anonymous_89) | |
|---|---|
| ✓ Was called | var utils = require('util');··· var EventEmifunction(options) { var token = options.token; var nextToken = options.nextToken; var atLeast = options.atLeast; var atMost = options.atMost; var exactly = options.exactly; if (token === nextToken) { throw new Error('You cannot specify the same token as both token and nextToken'); } if (atLeast === undefined && atMost === undefined && exactly === undefined) { throw new Error('You must specify at least one option'); } if (exactly !== undefined && (atLeast !== undefined || atMost !== undefined)) { throw new Error('You cannot specify atLeast or atMost with exactly'); } if (atLeast !== undefined && atMost !== undefined && atMost < atLeast) { throw new Error('atLeast and atMost are in conflict'); } }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var utils = require('util');··· { throw new Error('You cannot specify the same token as both token and nextToken'); } |
| ✓ Negative was executed (else) | var u··· if (atLeast === undefined && |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var utils = require('util');··· va{ throw new Error('You must specify at least one option'); } |
| ✓ Negative was executed (else) | var u··· if (exactly !== undefined && (atLeast !== undefined || atMost !== undefined)) { |
| Branch LogicalExpression | |
| ✓ Was returned | var utilexactly === undefined) { |
| ✓ Was returned | var utilatLeast === undefined &&··· atMost === undefined && |
| Branch LogicalExpression | |
| ✓ Was returned | var utilatMost === undefined && |
| ✓ Was returned | var utilatLeast === undefined && |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var utils = require('util');··· var EventEmitter = require('events').EventEmitter; /{ throw new Error('You cannot specify atLeast or atMost with exactly'); } |
| ✓ Negative was executed (else) | var u··· if (atLeast !== undefined && atMost !== undefined && atMost < atLeast) { |
| Branch LogicalExpression | |
| ✓ Was returned | var utils = require('util');··· var EatLeast !== undefined || atMost !== undefined)) { |
| ✓ Was returned | var utilexactly !== undefined && (atLeast !== undefined || atMost !== undefined)) { |
| Branch LogicalExpression | |
| ✓ Was returned | var utils = require('util');··· var EventEmitter = require('evatMost !== undefined)) { |
| ✓ Was returned | var utils = require('util');··· var EatLeast !== undefined || atMost !== undefined)) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var utils = require('util');··· var EventEmitter = require('events').EventEmit{ throw new Error('atLeast and atMost are in conflict'); } |
| ✓ Negative was executed (else) | var u··· }; |
| Branch LogicalExpression | |
| ✓ Was returned | var utils = require('util');··· var EventEmitter = require('atMost < atLeast) { |
| ✓ Was returned | var utilatLeast !== undefined && atMost !== undefined && atMost < atLeast) { |
| Branch LogicalExpression | |
| ✓ Was returned | var utils = require('util');··· var atMost !== undefined && atMost < atLeast) { |
| ✓ Was returned | var utilatLeast !== undefined && atMost !== undefined && atMost < atLeast) { |
| Function (anonymous_90) | |
|---|---|
| ✓ Was called | var utils = require('util');··· var EventEmitfunction(options, lineCount) { var token = options.nextToken; if (lineCount === 0) { if (options.stickToPreviousToken) { var nextToken = this._file.getNextToken(token, { includeComments: true }); this._file.setWhitespaceBefore(nextToken, this._file.getWhitespaceBefore(token)); } this._file.setWhitespaceBefore(token, ' '); return; } this._updateWhitespaceByLine(token, function(lines) { var currentLineCount = lines.length; var lastLine = lines[lines.length - 1]; if (currentLineCount <= lineCount) { // add additional lines that maintain the same indentation as the former last line for (; currentLineCount <= lineCount; currentLineCount++) { lines[lines.length - 1] = ''; lines.push(lastLine); } } else { // remove lines and then ensure that the new last line maintains the previous indentation lines = lines.slice(0, lineCount + 1); lines[lines.length - 1] = lastLine; } return lines; }); }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var utils = require('util{··· if (options.stickToPreviousToken) { var nextToken = this._file.getNextToken(token, { includeComments: true }); this._file.setWhitespaceBefore(nextToken, this._file.getWhitespaceBefore(token)); } this._file.setWhitespaceBefore(token, ' '); return; } |
| ✓ Negative was executed (else) | var u··· this._updateWhitespaceByLine(token, function(lines) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var utils = require('util');··· var EventEmit{ var nextToken = this._file.getNextToken(token, { includeComments: true }); this._file.setWhitespaceBefore(nextToken, this._file.getWhitespaceBefore(token)); } |
| ✓ Negative was executed (else) | var utils··· this._file.setWhitespaceBefore(token, ' '); |
| Function (anonymous_91) | |
|---|---|
| ✓ Was called | var utils = require('util');··· var EventEmfunction(lines) { var currentLineCount = lines.length; var lastLine = lines[lines.length - 1]; if (currentLineCount <= lineCount) { // add additional lines that maintain the same indentation as the former last line for (; currentLineCount <= lineCount; currentLineCount++) { lines[lines.length - 1] = ''; lines.push(lastLine); } } else { // remove lines and then ensure that the new last line maintains the previous indentation lines = lines.slice(0, lineCount + 1); lines[lines.length - 1] = lastLine; } return lines; }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var utils = require('util');··· var EventEmitt{ // add additional lines that maintain the same indentation as the former last line for (; currentLineCount <= lineCount; currentLineCount++) { lines[lines.length - 1] = ''; lines.push(lastLine); } } else { |
| ✓ Negative was executed (else) | var utils = req{··· // remove lines and then ensure that the new last line maintains the previous indentation lines = lines.slice(0, lineCount + 1); lines[lines.length - 1] = lastLine; } |
| Function (anonymous_92) | |
|---|---|
| ✓ Was called | var utils = require('util');··· var Evefunction(options) { var token = options.token; var actualTokenBefore = this._file.getPrevToken(token); var expectedTokenBefore = options.expectedTokenBefore; if (!actualTokenBefore) { this.emit('error', { message: expectedTokenBefore.value + ' was expected before ' + token.value + ' but document start found', line: token.loc.start.line, column: token.loc.start.column }); return; } // Only attempt to remove or add lines if there are no comments between the two nodes // as this prevents accidentally moving a valid token onto a line comment ed line var fixed = this._file.getPrevToken(options.token, {includeComments: true}) === actualTokenBefore; if ( actualTokenBefore.type !== expectedTokenBefore.type || actualTokenBefore.value !== expectedTokenBefore.value ) { if (fixed) { this._file.setWhitespaceBefore(token, expectedTokenBefore.value + this._file.getWhitespaceBefore(token)); } var message = options.message; if (!message) { var showTypes = expectedTokenBefore.value === actualTokenBefore.value; message = expectedTokenBefore.value + (showTypes ? ' (' + expectedTokenBefore.type + ')' : '') + ' was expected before ' + token.value + ' but ' + actualTokenBefore.value + (showTypes ? ' (' + actualTokenBefore.type + ')' : '') + ' found'; } this.emit('error', { message: message, line: actualTokenBefore.loc.end.line, column: actualTokenBefore.loc.end.column, fixed: fixed }); } }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var utils = require('util');{··· this.emit('error', { message: expectedTokenBefore.value + ' was expected before ' + token.value + ' but document start found', line: token.loc.start.line, column: token.loc.start.column }); return; } |
| ✓ Negative was executed (else) | var u··· // Only attempt to remove or add lines if there are no comments between the two nodes |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var ut{··· if (fixed) { this._file.setWhitespaceBefore(token, expectedTokenBefore.value + this._file.getWhitespaceBefore(token)); } var message = options.message; if (!message) { var showTypes = expectedTokenBefore.value === actualTokenBefore.value; message = expectedTokenBefore.value + (showTypes ? ' (' + expectedTokenBefore.type + ')' : '') + ' was expected before ' + token.value + ' but ' + actualTokenBefore.value + (showTypes ? ' (' + actualTokenBefore.type + ')' : '') + ' found'; } this.emit('error', { message: message, line: actualTokenBefore.loc.end.line, column: actualTokenBefore.loc.end.column, fixed: fixed }); } |
| ✓ Negative was executed (else) | var u··· }; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var utilactualTokenBefore.value !== expectedTokenBefore.value |
| ✓ Was returned | var utilactualTokenBefore.type !== expectedTokenBefore.type || |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var utils = require{··· this._file.setWhitespaceBefore(token, expectedTokenBefore.value + this._file.getWhitespaceBefore(token)); } |
| ✗ Negative was not executed (else) | var utils··· var message = options.message; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var utils = require('u{··· var showTypes = expectedTokenBefore.value === actualTokenBefore.value; message = expectedTokenBefore.value + (showTypes ? ' (' + expectedTokenBefore.type + ')' : '') + ' was expected before ' + token.value + ' but ' + actualTokenBefore.value + (showTypes ? ' (' + actualTokenBefore.type + ')' : '') + ' found'; } |
| ✓ Negative was executed (else) | var utils··· this.emit('error', { |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | var utils = require('util');··· var EventEmitter = require('' (' + expectedTokenBefore.type + ')' : '') + |
| ✓ Negative was returned (: ...) | var utils = require('util');··· var EventEmitter = require('events').EventEmitter; /** * Token ass'') + |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | var utils = require('util');··· var EventEmitter = require('events')' (' + actualTokenBefore.type + ')' : '') + ' found'; |
| ✓ Negative was returned (: ...) | var utils = require('util');··· var EventEmitter = require('events').EventEmitter; /** * Token assertion'') + ' found'; |
| Function (anonymous_93) | |
|---|---|
| ✓ Was called | var utils = require('util');··· var Eventfunction(options) { var token = options.token; var actualTokenBefore = this._file.getPrevToken(token); if (!actualTokenBefore) { // document start return; } var fixed = this._file.getPrevToken(options.token, { includeComments: true }) === actualTokenBefore; var expectedTokenBefore = options.expectedTokenBefore; if (actualTokenBefore.type === expectedTokenBefore.type && actualTokenBefore.value === expectedTokenBefore.value ) { if (fixed) { actualTokenBefore.value = ''; } this.emit('error', { message: options.message || 'Illegal ' + expectedTokenBefore.value + ' was found before ' + token.value, line: actualTokenBefore.loc.end.line, column: actualTokenBefore.loc.end.column, fixed: fixed }); } }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var utils = require('util');{··· // document start return; } |
| ✓ Negative was executed (else) | var u··· var fixed = this._file.getPrevToken(options.token, { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var ut{··· if (fixed) { actualTokenBefore.value = ''; } this.emit('error', { message: options.message || 'Illegal ' + expectedTokenBefore.value + ' was found before ' + token.value, line: actualTokenBefore.loc.end.line, column: actualTokenBefore.loc.end.column, fixed: fixed }); } |
| ✓ Negative was executed (else) | var u··· }; |
| Branch LogicalExpression | |
| ✓ Was returned | var utilactualTokenBefore.value === expectedTokenBefore.value |
| ✓ Was returned | var utilactualTokenBefore.type === expectedTokenBefore.type && |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var utils = require{··· actualTokenBefore.value = ''; } |
| ✗ Negative was not executed (else) | var utils··· this.emit('error', { |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var utils = require('util');··· var EventEm'Illegal ' + expectedTokenBefore.value + ' was found before ' + token.value, |
| ✓ Was returned | var utils = require('options.message || 'Illegal ' + expectedTokenBefore.value + ' was found before ' + token.value, |
| Function (anonymous_94) | |
|---|---|
| ✓ Was called | var assert = function(params) {··· params = params || {}; this._parseErrors = []; this._filename = params.filename; this._source = params.source; this._tree = {tokens: [], comments: []}; this._es3 = params.es3 || false; this._es6 = params.es6 || false; this._lineBreaks = null; this._lines = this._source.split(/\r\n|\r|\n/); var hasErrors = false; try { this._tree = parseJavaScriptSource(this._source, params.esprima, params.esprimaOptions); } catch (e) { hasErrors = true; this._parseErrors.push(e); } // Lazy initialization this._scope = null; this._tokens = this._buildTokenList(this._tree.tokens, this._tree.comments); this._addEOFToken(hasErrors); this._tokens = this._addWhitespaceTokens(this._tokens, this._source); this._setTokenIndexes(); var nodeIndexes = this._buildNodeIndex(); this._index = nodeIndexes.nodesByType; this._nodesByStartRange = nodeIndexes.nodesByStartRange; this._fixEsprimaIdentifiers(); this._buildDisabledRuleIndex(); }; |
| Branch LogicalExpression | |
|---|---|
| ✗ Was not returned | var assert = require('a{}; |
| ✓ Was returned | var assert = params || {}; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var assert = require('assert')false; |
| ✓ Was returned | var assert = reqparams.es3 || false; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var assert = require('assert')false; |
| ✓ Was returned | var assert = reqparams.es6 || false; |
| Function (anonymous_95) | |
|---|---|
| ✓ Was called | var assert = require('afunction() {··· var lineBreaks = this.getLineBreaks(); return lineBreaks.length ? lineBreaks[0] : '\n'; }, |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | var assert = require('assert');··· valineBreaks[0] : '\n'; |
| ✓ Negative was returned (: ...) | var assert = require('assert');··· var escope = requi'\n'; |
| Function (anonymous_96) | |
|---|---|
| ✓ Was called | var assert = requirfunction() {··· if (this._lineBreaks === null) { this._lineBreaks = this._source.match(/\r\n|\r|\n/g) || []; } return this._lineBreaks; }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var es{ this._lineBreaks = this._source.match(/\r\n|\r|\n/g) || []; } |
| ✓ Negative was executed (else) | var asser··· return this._lineBreaks; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var assert = require('assert');··· var escope = require('escope'); va[]; |
| ✓ Was returned | var assert = require('assert');this._source.match(/\r\n|\r|\n/g) || []; |
| Function (anonymous_97) | |
|---|---|
| ✓ Was called | var assert = require('function() {··· var tokenIndexes = this._buildTokenIndex(this._tokens); this._tokenRangeStartIndex = tokenIndexes.tokenRangeStartIndex; this._tokenRangeEndIndex = tokenIndexes.tokenRangeEndIndex; this._tokensByLineIndex = tokenIndexes.tokensByLineIndex; }, |
| Function (anonymous_98) | |
|---|---|
| ✓ Was called | var assert = require('assert'function() {··· this._disabledRuleIndex = []; var comments = this.getComments(); // Matches a comment enabling or disabling rules. var blockRe = /(jscs\s*:\s*(en|dis)able)(.*)/; // Matches a comment disbling a rule for one line. var lineRe = /(jscs\s*:\s*ignore)(.*)/; comments.forEach(function(comment) { var enabled; var value = comment.value.trim(); var blockParsed = blockRe.exec(value); var lineParsed = lineRe.exec(value); var line = comment.loc.start.line; if (blockParsed && blockParsed.index === 0) { enabled = blockParsed[2] === 'en'; this._addToDisabledRuleIndex(enabled, blockParsed[3], line); } else if (lineParsed && lineParsed.index === 0) { this._disableRulesAt(lineParsed[2], line); } }, this); }, |
| Function (anonymous_99) | |
|---|---|
| ✓ Was called | var assert = require('assfunction(comment) {··· var enabled; var value = comment.value.trim(); var blockParsed = blockRe.exec(value); var lineParsed = lineRe.exec(value); var line = comment.loc.start.line; if (blockParsed && blockParsed.index === 0) { enabled = blockParsed[2] === 'en'; this._addToDisabledRuleIndex(enabled, blockParsed[3], line); } else if (lineParsed && lineParsed.index === 0) { this._disableRulesAt(lineParsed[2], line); } }, this); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var escope = require('e{ enabled = blockParsed[2] === 'en'; this._addToDisabledRuleIndex(enabled, blockParsed[3], line); } else if (lineParsed && lineParsed.index === 0) { |
| ✓ Negative was executed (else) | var assert = requirif (lineParsed && lineParsed.index === 0) {··· this._disableRulesAt(lineParsed[2], line); } |
| Branch LogicalExpression | |
| ✓ Was returned | var assert = require('assert');blockParsed.index === 0) { |
| ✓ Was returned | var assert = reqblockParsed && blockParsed.index === 0) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var escope = require('escope{ this._disableRulesAt(lineParsed[2], line); } |
| ✓ Negative was executed (else) | var assert = ··· }, this); |
| Branch LogicalExpression | |
| ✓ Was returned | var assert = require('assert');··· var lineParsed.index === 0) { |
| ✓ Was returned | var assert = require('alineParsed && lineParsed.index === 0) { |
| Function (anonymous_100) | |
|---|---|
| ✓ Was called | var assert = require('assfunction(token, whitespace) {··· var whitespaceToken = this.getPrevToken(token, {includeWhitespace: true}); if (whitespaceToken && whitespaceToken.type === 'Whitespace') { // Modifying already existing token. if (whitespace === '') { this.removeToken(whitespaceToken); } else { whitespaceToken.value = whitespace; } } else if (whitespace !== '') { var tokenIndex = token._tokenIndex; // Adding a token before specified one. this._tokens.splice(tokenIndex, 0, { type: 'Whitespace', value: whitespace, isWhitespace: true }); // Quickly updating modified token order for (var i = tokenIndex; i < this._tokens.length; i++) { this._tokens[i]._tokenIndex = i; } } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var escope = require('escope'); var { // Modifying already existing token. if (whitespace === '') { this.removeToken(whitespaceToken); } else { whitespaceToken.value = whitespace; } } else if (whitespace !== '') { |
| ✓ Negative was executed (else) | var assert = reif (whitespace !== '') {··· var tokenIndex = token._tokenIndex; // Adding a token before specified one. this._tokens.splice(tokenIndex, 0, { type: 'Whitespace', value: whitespace, isWhitespace: true }); // Quickly updating modified token order for (var i = tokenIndex; i < this._tokens.length; i++) { this._tokens[i]._tokenIndex = i; } } |
| Branch LogicalExpression | |
| ✓ Was returned | var assert = require('assert');whitespaceToken.type === 'Whitespace') { |
| ✓ Was returned | var assert =whitespaceToken && whitespaceToken.type === 'Whitespace') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· va{ this.removeToken(whitespaceToken); } else { |
| ✓ Negative was executed (else) | var assert = requir{··· whitespaceToken.value = whitespace; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var e{ var tokenIndex = token._tokenIndex; // Adding a token before specified one. this._tokens.splice(tokenIndex, 0, { type: 'Whitespace', value: whitespace, isWhitespace: true }); // Quickly updating modified token order for (var i = tokenIndex; i < this._tokens.length; i++) { this._tokens[i]._tokenIndex = i; } } |
| ✓ Negative was executed (else) | var asser··· }, |
| Function (anonymous_101) | |
|---|---|
| ✓ Was called | var assert = require('assfunction(token) {··· var whitespaceToken = this.getPrevToken(token, {includeWhitespace: true}); if (whitespaceToken && whitespaceToken.type === 'Whitespace') { return whitespaceToken.value; } else { return ''; } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var escope = require('escope'); var { return whitespaceToken.value; } else { |
| ✓ Negative was executed (else) | var assert = re{··· return ''; } |
| Branch LogicalExpression | |
| ✓ Was returned | var assert = require('assert');whitespaceToken.type === 'Whitespace') { |
| ✓ Was returned | var assert =whitespaceToken && whitespaceToken.type === 'Whitespace') { |
| Function (anonymous_102) | |
|---|---|
| ✓ Was called | var assert = requifunction(entities, entity) {··· for (var i = 0; i < entities.length; i++) { if (entities[i] === entity) { entities.splice(i, 1); return; } } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var esc{ entities.splice(i, 1); return; } |
| ✓ Negative was executed (else) | var assert = ··· } |
| Function (anonymous_103) | |
|---|---|
| ✓ Was called | var assert = requfunction(token) {··· this.removeEntity(this._tokens, token); this._setTokenIndexes(); }, |
| Function (anonymous_104) | |
|---|---|
| ✓ Was called | var assert = require(function(rules, line) {··· rules = rules.split(/\s*,\s*/); for (var i = 0; i < rules.length; i++) { if (!this.isEnabledRule(rules[i], line)) { continue; } this._addToDisabledRuleIndex(false, rules[i], line); this._addToDisabledRuleIndex(true, rules[i], line + 1); } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var escope = require{ continue; } |
| ✓ Negative was executed (else) | var assert = ··· this._addToDisabledRuleIndex(false, rules[i], line); |
| Function (anonymous_105) | |
|---|---|
| ✓ Was called | var assert = requirfunction(ruleName, line) {··· var enabled = true; ruleName = ruleName.trim(); this._disabledRuleIndex.some(function(region) { // once the comment we're inspecting occurs after the location of the error, // no longer check for whether the state is enabled or disable if (region.line > line) { return true; } if (region.rule === ruleName || region.rule === '*') { enabled = region.enabled; } }, this); return enabled; }, |
| Function (anonymous_106) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var function(region) { // once the comment we're inspecting occurs after the location of the error, // no longer check for whether the state is enabled or disable if (region.line > line) { return true; } if (region.rule === ruleName || region.rule === '*') { enabled = region.enabled; } }, this); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var{ return true; } |
| ✓ Negative was executed (else) | var assert = ··· if (region.rule === ruleName || region.rule === '*') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var escope = require('escope'); { enabled = region.enabled; } |
| ✓ Negative was executed (else) | var assert = ··· }, this); |
| Branch LogicalExpression | |
| ✓ Was returned | var assert = require('assert');··· var escope region.rule === '*') { |
| ✓ Was returned | var assert = reqregion.rule === ruleName || region.rule === '*') { |
| Function (anonymous_107) | |
|---|---|
| ✓ Was called | var assert = require('assert'function(enabled, rulesStr, line) {··· rulesStr = rulesStr || '*'; rulesStr.split(',').forEach(function(rule) { rule = rule.trim(); if (!rule) { return; } this._disabledRuleIndex.push({ rule: rule, enabled: enabled, line: line }); }, this); }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var assert = require('assert');'*'; |
| ✓ Was returned | var assert = requirrulesStr || '*'; |
| Function (anonymous_108) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· varfunction(rule) { rule = rule.trim(); if (!rule) { return; } this._disabledRuleIndex.push({ rule: rule, enabled: enabled, line: line }); }, this); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('a{··· return; } |
| ✓ Negative was executed (else) | var assert = ··· this._disabledRuleIndex.push({ |
| Function (anonymous_109) | |
|---|---|
| ✓ Was called | var assert = require('function(tokens) {··· var tokenRangeStartIndex = {}; var tokenRangeEndIndex = {}; var tokensByLineIndex = {}; for (var i = 0, l = tokens.length; i < l; i++) { var token = tokens[i]; token._tokenIndex = i; if (token.type === 'Whitespace') { continue; } // tokens by range tokenRangeStartIndex[token.range[0]] = token; tokenRangeEndIndex[token.range[1]] = token; // tokens by line var lineNumber = token.loc.start.line; if (!tokensByLineIndex[lineNumber]) { tokensByLineIndex[lineNumber] = []; } tokensByLineIndex[lineNumber].push(token); } return { tokenRangeStartIndex: tokenRangeStartIndex, tokenRangeEndIndex: tokenRangeEndIndex, tokensByLineIndex: tokensByLineIndex }; }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var escope ={ continue; } |
| ✓ Negative was executed (else) | var assert = ··· // tokens by range |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var escope = re{ tokensByLineIndex[lineNumber] = []; } |
| ✓ Negative was executed (else) | var assert = ··· tokensByLineIndex[lineNumber].push(token); |
| Function (anonymous_110) | |
|---|---|
| ✓ Was called | var assert = require('assefunction(start) {··· return this._tokenRangeStartIndex[start] || null; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var assert = require('assert');··· var escope = requirnull; |
| ✓ Was returned | var assert = rethis._tokenRangeStartIndex[start] || null; |
| Function (anonymous_111) | |
|---|---|
| ✓ Was called | var assert = require('asfunction(end) {··· return this._tokenRangeEndIndex[end] || null; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var assert = require('assert');··· var escope = renull; |
| ✓ Was returned | var assert = rethis._tokenRangeEndIndex[end] || null; |
| Function (anonymous_112) | |
|---|---|
| ✓ Was called | var assert = require('afunction(node) {··· return this.getTokenByRangeStart(node.range[0]); }, |
| Function (anonymous_113) | |
|---|---|
| ✓ Was called | var assert = require('function(node) {··· return this.getTokenByRangeEnd(node.range[1]); }, |
| Function (anonymous_114) | |
|---|---|
| ✓ Was called | var assert = requirfunction(options) {··· return this._getTokenFromIndex(0, 1, options); }, |
| Function (anonymous_115) | |
|---|---|
| ✓ Was called | var assert = requifunction(options) {··· return this._getTokenFromIndex(this._tokens.length - 1, -1, options); }, |
| Function (anonymous_116) | |
|---|---|
| ✓ Was called | var assert = require('asfunction(index, direction, options) {··· while (true) { var followingToken = this._tokens[index]; if (!followingToken) { return null; } if ( (!followingToken.isComment || (options && options.includeComments)) && (!followingToken.isWhitespace || (options && options.includeWhitespace)) ) { return followingToken; } index += direction; } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· { return null; } |
| ✓ Negative was executed (else) | var assert = ··· if ( |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = r{··· return followingToken; } |
| ✓ Negative was executed (else) | var assert = ··· index += direction; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var assert = requ!followingToken.isWhitespace || (options && options.includeWhitespace)) |
| ✓ Was returned | var assert = requ!followingToken.isComment || (options && options.includeComments)) && |
| Branch LogicalExpression | |
| ✓ Was returned | var assert = require('assert');··· var escope = roptions && options.includeComments)) && |
| ✓ Was returned | var assert = requ!followingToken.isComment || (options && options.includeComments)) && |
| Branch LogicalExpression | |
| ✓ Was returned | var assert = require('assert');··· var escope = require('escoptions.includeComments)) && |
| ✗ Was not returned | var assert = require('assert');··· var escope = roptions && options.includeComments)) && |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var assert = require('assert');··· var escope = requoptions && options.includeWhitespace)) |
| ✓ Was returned | var assert = requ!followingToken.isWhitespace || (options && options.includeWhitespace)) |
| Branch LogicalExpression | |
| ✓ Was returned | var assert = require('assert');··· var escope = require('escopeoptions.includeWhitespace)) |
| ✓ Was returned | var assert = require('assert');··· var escope = requoptions && options.includeWhitespace)) |
| Function (anonymous_117) | |
|---|---|
| ✓ Was called | var assert = requifunction(token, options) {··· return this._getTokenFromIndex(token._tokenIndex - 1, -1, options); }, |
| Function (anonymous_118) | |
|---|---|
| ✓ Was called | var assert = requifunction(token, options) {··· return this._getTokenFromIndex(token._tokenIndex + 1, 1, options); }, |
| Function (anonymous_119) | |
|---|---|
| ✓ Was called | var assert = requirfunction(token, type, value) {··· var prevToken = this.getPrevToken(token); while (prevToken) { if (prevToken.type === type && (value === undefined || prevToken.value === value)) { return prevToken; } prevToken = this.getPrevToken(prevToken); } return prevToken; }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var escope = require('escope'); var treeIterator = require('.{ return prevToken; } |
| ✓ Negative was executed (else) | var assert = ··· prevToken = this.getPrevToken(prevToken); |
| Branch LogicalExpression | |
| ✓ Was returned | var assert = require('assert');··· var escope value === undefined || prevToken.value === value)) { |
| ✓ Was returned | var assert = reqprevToken.type === type && (value === undefined || prevToken.value === value)) { |
| Branch LogicalExpression | |
| ✓ Was returned | var assert = require('assert');··· var escope = require('escope'); vprevToken.value === value)) { |
| ✓ Was returned | var assert = require('assert');··· var escope value === undefined || prevToken.value === value)) { |
| Function (anonymous_120) | |
|---|---|
| ✓ Was called | var assert = requirfunction(token, type, value) {··· var nextToken = this.getNextToken(token); while (nextToken) { if (nextToken.type === type && (value === undefined || nextToken.value === value)) { return nextToken; } nextToken = this.getNextToken(nextToken); } return nextToken; }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var escope = require('escope'); var treeIterator = require('.{ return nextToken; } |
| ✓ Negative was executed (else) | var assert = ··· nextToken = this.getNextToken(nextToken); |
| Branch LogicalExpression | |
| ✓ Was returned | var assert = require('assert');··· var escope value === undefined || nextToken.value === value)) { |
| ✓ Was returned | var assert = reqnextToken.type === type && (value === undefined || nextToken.value === value)) { |
| Branch LogicalExpression | |
| ✓ Was returned | var assert = require('assert');··· var escope = require('escope'); vnextToken.value === value)) { |
| ✓ Was returned | var assert = require('assert');··· var escope value === undefined || nextToken.value === value)) { |
| Function (anonymous_121) | |
|---|---|
| ✓ Was called | var assert = require('asserfunction(token, value) {··· return this.findPrevToken(token, value in KEYWORD_OPERATORS ? 'Keyword' : 'Punctuator', value); }, |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | var assert = require('assert');··· var escope = require('escope'); var 'Keyword' : 'Punctuator', value); |
| ✓ Negative was returned (: ...) | var assert = require('assert');··· var escope = require('escope'); var treeIterator'Punctuator', value); |
| Function (anonymous_122) | |
|---|---|
| ✓ Was called | var assert = require('asserfunction(token, value) {··· return this.findNextToken(token, value in KEYWORD_OPERATORS ? 'Keyword' : 'Punctuator', value); }, |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | var assert = require('assert');··· var escope = require('escope'); var 'Keyword' : 'Punctuator', value); |
| ✓ Negative was returned (: ...) | var assert = require('assert');··· var escope = require('escope'); var treeIterator'Punctuator', value); |
| Function (anonymous_123) | |
|---|---|
| ✓ Was called | var assert = function(cb, tree) {··· return treeIterator.iterate(tree || this._tree, cb); }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var assert = require('assert');··· var escope this._tree, cb); |
| ✓ Was returned | var assert = require('assert');··· vartree || this._tree, cb); |
| Function (anonymous_124) | |
|---|---|
| ✓ Was called | var assert = requirefunction(number) {··· assert(typeof number === 'number', 'requires node range argument'); var result = {}; // Look backwards for the first node(s) spanning `number` // (possible with this.iterate, but too slow on large files) var i = number; var nodes; do { // Escape hatch if (i < 0) { return result; } nodes = this._nodesByStartRange[i]; i--; } while (!nodes || nodes[0].range[1] <= number); // Return the deepest such node for (i = nodes.length - 1; i >= 0; i--) { if (nodes[i].range[1] > number) { return nodes[i]; } } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('a{··· return result; } |
| ✓ Negative was executed (else) | var assert = ··· nodes = this._nodesByStartRange[i]; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var assert = require('assernodes[0].range[1] <= number); |
| ✓ Was returned | var assert = requ!nodes || nodes[0].range[1] <= number); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var escope { return nodes[i]; } |
| ✓ Negative was executed (else) | var assert = ··· } |
| Function (anonymous_125) | |
|---|---|
| ✓ Was called | var assert = require('assefunction(token) {··· var result = []; if (token && token.range && token.range[0] >= 0) { var nodes = this._nodesByStartRange[token.range[0]]; if (nodes) { result = result.concat(nodes); } } return result; }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var escope = require('es{ var nodes = this._nodesByStartRange[token.range[0]]; if (nodes) { result = result.concat(nodes); } } |
| ✓ Negative was executed (else) | var asser··· return result; |
| Branch LogicalExpression | |
| ✓ Was returned | var assert = require('assert');··· vartoken.range[0] >= 0) { |
| ✓ Was returned | var assert =token && token.range && token.range[0] >= 0) { |
| Branch LogicalExpression | |
| ✓ Was returned | var assert = require(token.range && token.range[0] >= 0) { |
| ✓ Was returned | var assert =token && token.range && token.range[0] >= 0) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('a{··· result = result.concat(nodes); } |
| ✓ Negative was executed (else) | var assert = ··· } |
| Function (anonymous_126) | |
|---|---|
| ✓ Was called | var assert = requirefunction(type) {··· if (typeof type === 'string') { return this._index[type] || []; } else { var result = []; for (var i = 0, l = type.length; i < l; i++) { var nodes = this._index[type[i]]; if (nodes) { result = result.concat(nodes); } } return result; } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var e{ return this._index[type] || []; } else { |
| ✓ Negative was executed (else) | var assert = re{··· var result = []; for (var i = 0, l = type.length; i < l; i++) { var nodes = this._index[type[i]]; if (nodes) { result = result.concat(nodes); } } return result; } |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var assert = require('assert');··· var esc[]; |
| ✓ Was returned | var assert = requirthis._index[type] || []; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('asser{··· result = result.concat(nodes); } |
| ✓ Negative was executed (else) | var assert = requ··· } |
| Function (anonymous_127) | |
|---|---|
| ✓ Was called | var assert = require('asfunction(type, cb, context) {··· return this.getNodesByType(type).forEach(cb, context || this); }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var assert = require('assert');··· var escope = require('escope');this); |
| ✗ Was not returned | var assert = require('assert');··· var escope = requirecontext || this); |
| Function (anonymous_128) | |
|---|---|
| ✓ Was called | var assert = require('assfunction(type, cb) {··· var types = (typeof type === 'string') ? [type] : type; var typeIndex = {}; types.forEach(function(type) { typeIndex[type] = true; }); this._forEachToken(function(token, index, tokens) { if (typeIndex[token.type]) { cb(token, index, tokens); } }); }, |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | var assert = require('assert');··· var escope = req[type] : type; |
| ✓ Negative was returned (: ...) | var assert = require('assert');··· var escope = require('esctype; |
| Function (anonymous_129) | |
|---|---|
| ✓ Was called | var assert = require('function(type) {··· typeIndex[type] = true; }); |
| Function (anonymous_130) | |
|---|---|
| ✓ Was called | var assert = require('asserfunction(token, index, tokens) {··· if (typeIndex[token.type]) { cb(token, index, tokens); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var es{ cb(token, index, tokens); } |
| ✓ Negative was executed (else) | var assert = ··· }); |
| Function (anonymous_131) | |
|---|---|
| ✓ Was called | var assert = require('assfunction(name, cb) {··· var names = (typeof name === 'string') ? [name] : name; var nameIndex = {}; names.forEach(function(type) { nameIndex[type] = true; }); this._forEachToken(function(token, index, tokens) { if (nameIndex.hasOwnProperty(token.value)) { cb(token, index, tokens); } }); }, |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | var assert = require('assert');··· var escope = req[name] : name; |
| ✓ Negative was returned (: ...) | var assert = require('assert');··· var escope = require('escname; |
| Function (anonymous_132) | |
|---|---|
| ✓ Was called | var assert = require('function(type) {··· nameIndex[type] = true; }); |
| Function (anonymous_133) | |
|---|---|
| ✓ Was called | var assert = require('asserfunction(token, index, tokens) {··· if (nameIndex.hasOwnProperty(token.value)) { cb(token, index, tokens); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var escope = require('{ cb(token, index, tokens); } |
| ✓ Negative was executed (else) | var assert = ··· }); |
| Function (anonymous_134) | |
|---|---|
| ✓ Was called | var assert = requirfunction(cb) {··· var index = 0; var tokens = this._tokens; while (index < tokens.length) { var token = tokens[index]; cb(token, index, tokens); index = token._tokenIndex; index++; } }, |
| Function (anonymous_135) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· function(type, value, cb) { var values = (typeof value === 'string') ? [value] : value; var valueIndex = {}; values.forEach(function(type) { valueIndex[type] = true; }); this._forEachToken(function(token, index, tokens) { if (token.type === type && valueIndex[token.value]) { cb(token, index, tokens); } }); }, |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | var assert = require('assert');··· var escope = requi[value] : value; |
| ✓ Negative was returned (: ...) | var assert = require('assert');··· var escope = require('escopevalue; |
| Function (anonymous_136) | |
|---|---|
| ✓ Was called | var assert = require('afunction(type) {··· valueIndex[type] = true; }); |
| Function (anonymous_137) | |
|---|---|
| ✓ Was called | var assert = require('asserfunction(token, index, tokens) {··· if (token.type === type && valueIndex[token.value]) { cb(token, index, tokens); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var escope = require('escope');{ cb(token, index, tokens); } |
| ✓ Negative was executed (else) | var assert = ··· }); |
| Branch LogicalExpression | |
| ✓ Was returned | var assert = require('assert');··· var esvalueIndex[token.value]) { |
| ✓ Was returned | var assert = reqtoken.type === type && valueIndex[token.value]) { |
| Function (anonymous_138) | |
|---|---|
| ✓ Was called | var assert = require('assfunction(lineNumber, options) {··· var tokensByLine = this._tokensByLineIndex[lineNumber]; if (!tokensByLine) { return null; } if (options && options.includeComments) { return tokensByLine[0]; } for (var i = 0; i < tokensByLine.length; i++) { var token = tokensByLine[i]; if (!token.isComment) { return token; } } return null; }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('asser{··· return null; } |
| ✓ Negative was executed (else) | var asser··· if (options && options.includeComments) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var escope = re{ return tokensByLine[0]; } |
| ✓ Negative was executed (else) | var asser··· for (var i = 0; i < tokensByLine.length; i++) { |
| Branch LogicalExpression | |
| ✓ Was returned | var assert = require('aoptions.includeComments) { |
| ✓ Was returned | var assert =options && options.includeComments) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· v{ return token; } |
| ✓ Negative was executed (else) | var assert = ··· } |
| Function (anonymous_139) | |
|---|---|
| ✓ Was called | var assert = require('asfunction(lineNumber, options) {··· var tokensByLine = this._tokensByLineIndex[lineNumber]; if (!tokensByLine) { return null; } if (options && options.includeComments) { return tokensByLine[tokensByLine.length - 1]; } for (var i = tokensByLine.length - 1; i >= 0; i--) { var token = tokensByLine[i]; if (!token.isComment) { return token; } } return null; }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('asser{··· return null; } |
| ✓ Negative was executed (else) | var asser··· if (options && options.includeComments) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var escope = re{ return tokensByLine[tokensByLine.length - 1]; } |
| ✓ Negative was executed (else) | var asser··· for (var i = tokensByLine.length - 1; i >= 0; i--) { |
| Branch LogicalExpression | |
| ✓ Was returned | var assert = require('aoptions.includeComments) { |
| ✓ Was returned | var assert =options && options.includeComments) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· v{ return token; } |
| ✓ Negative was executed (else) | var assert = ··· } |
| Function (anonymous_140) | |
|---|---|
| ✓ Was called | var assert = reqfunction() {··· if (this._es6) { return 'es6'; } if (this._es3) { return 'es3'; } return 'es5'; }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('a{··· return 'es6'; } |
| ✓ Negative was executed (else) | var asser··· if (this._es3) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('a{··· return 'es3'; } |
| ✓ Negative was executed (else) | var asser··· return 'es5'; |
| Function (anonymous_141) | |
|---|---|
| ✓ Was called | var assert = refunction() {··· return this._source; }, |
| Function (anonymous_142) | |
|---|---|
| ✓ Was called | var assert = function() {··· return this._tree; }, |
| Function (anonymous_143) | |
|---|---|
| ✓ Was called | var assert = refunction() {··· return this._tokens; }, |
| Function (anonymous_144) | |
|---|---|
| ✗ Was not called | var assert = refunction(tokens) {··· this._tokens = tokens; }, |
| Function (anonymous_145) | |
|---|---|
| ✓ Was called | var assert = requfunction() {··· return this._tree.comments; }, |
| Function (anonymous_146) | |
|---|---|
| ✓ Was called | var assert = requfunction() {··· return this._filename; }, |
| Function (anonymous_147) | |
|---|---|
| ✓ Was called | var assert = rfunction() {··· return this._lines; }, |
| Function (anonymous_148) | |
|---|---|
| ✓ Was called | var assert = rfunction() {··· if (!this._scope) { this._scope = escope.analyze(this._tree, { ecmaVersion: 6, ignoreEval: true, sourceType: 'module' }); } return this._scope; }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('asse{··· this._scope = escope.analyze(this._tree, { ecmaVersion: 6, ignoreEval: true, sourceType: 'module' }); } |
| ✗ Negative was not executed (else) | var asser··· return this._scope; |
| Function (anonymous_149) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· function() { var lines = this.getLines().concat(); this.getComments().concat().reverse().forEach(function(comment) { var startLine = comment.loc.start.line; var startCol = comment.loc.start.column; var endLine = comment.loc.end.line; var endCol = comment.loc.end.column; var i = startLine - 1; if (startLine === endLine) { // Remove tralling spaces (see gh-1968) lines[i] = lines[i].replace(/\*\/\s+/, '\*\/'); lines[i] = lines[i].substring(0, startCol) + lines[i].substring(endCol); } else { lines[i] = lines[i].substring(0, startCol); for (var x = i + 1; x < endLine - 1; x++) { lines[x] = ''; } lines[x] = lines[x].substring(endCol); } }); return lines; }, |
| Function (anonymous_150) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var escope = require(function(comment) { var startLine = comment.loc.start.line; var startCol = comment.loc.start.column; var endLine = comment.loc.end.line; var endCol = comment.loc.end.column; var i = startLine - 1; if (startLine === endLine) { // Remove tralling spaces (see gh-1968) lines[i] = lines[i].replace(/\*\/\s+/, '\*\/'); lines[i] = lines[i].substring(0, startCol) + lines[i].substring(endCol); } else { lines[i] = lines[i].substring(0, startCol); for (var x = i + 1; x < endLine - 1; x++) { lines[x] = ''; } lines[x] = lines[x].substring(endCol); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var es{ // Remove tralling spaces (see gh-1968) lines[i] = lines[i].replace(/\*\/\s+/, '\*\/'); lines[i] = lines[i].substring(0, startCol) + lines[i].substring(endCol); } else { |
| ✓ Negative was executed (else) | var assert = requir{··· lines[i] = lines[i].substring(0, startCol); for (var x = i + 1; x < endLine - 1; x++) { lines[x] = ''; } lines[x] = lines[x].substring(endCol); } |
| Function (anonymous_151) | |
|---|---|
| ✓ Was called | var assert =function() {··· var result = ''; // For-loop for maximal speed. for (var i = 0; i < this._tokens.length; i++) { var token = this._tokens[i]; switch (token.type) { // Line-comment: // ... case 'Line': result += '//' + token.value; break; // Block-comment: /* ... */ case 'Block': result += '/*' + token.value + '*/'; break; default: result += token.value; } } return result; }, |
| Branch SwitchStatement | |
|---|---|
| ✓ Was evaluated | var assert = reqcase 'Line':··· result += '//' + token.value; break; |
| ✓ Was evaluated | var assert = reqcase 'Block':··· result += '/*' + token.value + '*/'; break; |
| ✓ Was evaluated | var assert = reqdefault:··· result += token.value; |
| Function (anonymous_152) | |
|---|---|
| ✓ Was called | var assert = requirefunction() {··· return this._parseErrors; }, |
| Function (anonymous_153) | |
|---|---|
| ✓ Was called | var assert = require(function(codeTokens, commentTokens) {··· var result = []; var codeQueue = codeTokens.concat(); var commentQueue = commentTokens.concat(); while (codeQueue.length > 0 || commentQueue.length > 0) { if (codeQueue.length > 0 && (!commentQueue.length || commentQueue[0].range[0] > codeQueue[0].range[0])) { result.push(codeQueue.shift()); } else { var commentToken = commentQueue.shift(); commentToken.isComment = true; result.push(commentToken); } } return result; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var assert = require('assert');··· var escommentQueue.length > 0) { |
| ✓ Was returned | var assert = recodeQueue.length > 0 || commentQueue.length > 0) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var escope = require('escope'); var treeIterator = require('./tree-iterator'); /*{ result.push(codeQueue.shift()); } else { |
| ✓ Negative was executed (else) | var assert = requir{··· var commentToken = commentQueue.shift(); commentToken.isComment = true; result.push(commentToken); } |
| Branch LogicalExpression | |
| ✓ Was returned | var assert = require('assert');··· var esco!commentQueue.length || commentQueue[0].range[0] > codeQueue[0].range[0])) { |
| ✓ Was returned | var assert = reqcodeQueue.length > 0 && (!commentQueue.length || commentQueue[0].range[0] > codeQueue[0].range[0])) { |
| Branch LogicalExpression | |
| ✓ Was returned | var assert = require('assert');··· var escope = require('escope'); commentQueue[0].range[0] > codeQueue[0].range[0])) { |
| ✓ Was returned | var assert = require('assert');··· var esco!commentQueue.length || commentQueue[0].range[0] > codeQueue[0].range[0])) { |
| Function (anonymous_154) | |
|---|---|
| ✓ Was called | var assert = requifunction(hasErrors) {··· var loc = hasErrors ? {line: 0, column: 0} : { line: this._lines.length, column: this._lines[this._lines.length - 1].length }; this._tokens.push({ type: 'EOF', value: '', range: hasErrors ? [0, 0] : [this._source.length, this._source.length + 1], loc: {start: loc, end: loc} }); }, |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | var assert ={line: 0, column: 0} : |
| ✓ Negative was returned (: ...) | var assert ={··· line: this._lines.length, column: this._lines[this._lines.length - 1].length }; |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | var assert = require('assert');[0, 0] : [this._source.length, this._source.length + 1], |
| ✓ Negative was returned (: ...) | var assert = require('assert');··· var esc[this._source.length, this._source.length + 1], |
| Function (anonymous_155) | |
|---|---|
| ✓ Was called | var assert = require('assefunction(tokens, source) {··· var prevPos = 0; var result = []; // For-loop for maximal speed. for (var i = 0; i < tokens.length; i++) { var token = tokens[i]; var rangeStart = token.range[0]; if (rangeStart !== prevPos) { var whitespace = source.substring(prevPos, rangeStart); result.push({ type: 'Whitespace', value: whitespace, isWhitespace: true }); } result.push(token); prevPos = token.range[1]; } return result; }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var esc{ var whitespace = source.substring(prevPos, rangeStart); result.push({ type: 'Whitespace', value: whitespace, isWhitespace: true }); } |
| ✓ Negative was executed (else) | var assert = ··· result.push(token); |
| Function (anonymous_156) | |
|---|---|
| ✓ Was called | var assert = require(function() {··· var nodesByType = {}; var nodesByStartRange = {}; this.iterate(function(node, parentNode, parentCollection) { var type = node.type; node.parentNode = parentNode; node.parentCollection = parentCollection; (nodesByType[type] || (nodesByType[type] = [])).push(node); // this part builds a node index that uses node start ranges as the key var startRange = node.range[0]; (nodesByStartRange[startRange] || (nodesByStartRange[startRange] = [])).push(node); }); return { nodesByType: nodesByType, nodesByStartRange: nodesByStartRange }; }, |
| Function (anonymous_157) | |
|---|---|
| ✓ Was called | var assert = require(function(node, parentNode, parentCollection) {··· var type = node.type; node.parentNode = parentNode; node.parentCollection = parentCollection; (nodesByType[type] || (nodesByType[type] = [])).push(node); // this part builds a node index that uses node start ranges as the key var startRange = node.range[0]; (nodesByStartRange[startRange] || (nodesByStartRange[startRange] = [])).push(node); }); |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var assert = require('assert');··· vanodesByType[type] = [])).push(node); |
| ✓ Was returned | var assert = nodesByType[type] || (nodesByType[type] = [])).push(node); |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var assert = require('assert');··· var escope = rnodesByStartRange[startRange] = [])).push(node); |
| ✓ Was returned | var assert = nodesByStartRange[startRange] || (nodesByStartRange[startRange] = [])).push(node); |
| Function (anonymous_158) | |
|---|---|
| ✓ Was called | var assert = require('assertfunction() {··· var _this = this; this.iterateNodesByType(['Property', 'MethodDefinition', 'MemberExpression'], function(node) { switch (node.type) { case 'Property': convertKeywordToIdentifierIfRequired(node.key); break; case 'MethodDefinition': convertKeywordToIdentifierIfRequired(node.key); break; case 'MemberExpression': convertKeywordToIdentifierIfRequired(node.property); break; } }); function convertKeywordToIdentifierIfRequired(node) { var token = _this.getTokenByRangeStart(node.range[0]); if (token.type === 'Keyword') { token.type = 'Identifier'; } } } |
| Function (anonymous_159) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var escope = require('escope'); var treeIterator = rfunction(node) { switch (node.type) { case 'Property': convertKeywordToIdentifierIfRequired(node.key); break; case 'MethodDefinition': convertKeywordToIdentifierIfRequired(node.key); break; case 'MemberExpression': convertKeywordToIdentifierIfRequired(node.property); break; } }); |
| Branch SwitchStatement | |
|---|---|
| ✓ Was evaluated | var assert = reqcase 'Property':··· convertKeywordToIdentifierIfRequired(node.key); break; |
| ✓ Was evaluated | var assert = reqcase 'MethodDefinition':··· convertKeywordToIdentifierIfRequired(node.key); break; |
| ✓ Was evaluated | var assert = reqcase 'MemberExpression':··· convertKeywordToIdentifierIfRequired(node.property); break; |
| Function convertKeywordToIdentifierIfRequired | |
|---|---|
| ✓ Was called | var assefunction convertKeywordToIdentifierIfRequired(node) {··· var token = _this.getTokenByRangeStart(node.range[0]); if (token.type === 'Keyword') { token.type = 'Identifier'; } } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var escop{ token.type = 'Identifier'; } |
| ✓ Negative was executed (else) | var assert = ··· } |
| Function parseJavaScriptSource | |
|---|---|
| ✓ Was called | function parseJavaScriptSource(source, esprima, esprimaOptions) {··· var finalEsprimaOptions = { tolerant: true }; if (esprimaOptions) { for (var key in esprimaOptions) { finalEsprimaOptions[key] = esprimaOptions[key]; } } // Set required options finalEsprimaOptions.loc = true; finalEsprimaOptions.range = true; finalEsprimaOptions.comment = true; finalEsprimaOptions.tokens = true; finalEsprimaOptions.sourceType = 'module'; var hashbang = source.indexOf('#!') === 0; var tree; // Convert bin annotation to a comment if (hashbang) { source = '//' + source.substr(2); } var instrumentationData = {}; var hasInstrumentationData = false; // Process special case code like iOS instrumentation imports: `#import 'abc.js';` source = source.replace(/^#!?[^\n]+\n/gm, function(str, pos) { hasInstrumentationData = true; instrumentationData[pos] = str.substring(0, str.length - 1); return '//' + str.slice(2); }); var gritData = {}; var hasGritData = false; // Process grit tags like `<if ...>` and `<include ...>` source = source.replace(/^\s*<\/?\s*(if|include)(?!\w)[^]*?>/gim, function(str, p1, pos) { hasGritData = true; gritData[pos] = str.substring(0, str.length - 1); // Cut 4 characters to save correct line/column info for surrounding code return '/*' + str.slice(4) + '*/'; }); tree = esprima.parse(source, finalEsprimaOptions); // Change the bin annotation comment if (hashbang) { tree.comments[0].type = 'Hashbang'; tree.comments[0].value = '#!' + tree.comments[0].value; } if (hasInstrumentationData) { tree.comments.forEach(function(token) { var rangeStart = token.range[0]; if (instrumentationData.hasOwnProperty(rangeStart)) { token.type = 'InstrumentationDirective'; token.value = instrumentationData[rangeStart]; } }); } if (hasGritData) { tree.comments.forEach(function(token) { var rangeStart = token.range[0]; if (gritData.hasOwnProperty(rangeStart)) { token.type = 'GritTag'; token.value = gritData[rangeStart]; } }); } return tree; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('as{··· for (var key in esprimaOptions) { finalEsprimaOptions[key] = esprimaOptions[key]; } } |
| ✓ Negative was executed (else) | var a··· // Set required options |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = requi{··· source = '//' + source.substr(2); } |
| ✓ Negative was executed (else) | var a··· var instrumentationData = {}; |
| Function (anonymous_162) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var escope = function(str, pos) { hasInstrumentationData = true; instrumentationData[pos] = str.substring(0, str.length - 1); return '//' + str.slice(2); }); |
| Function (anonymous_163) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var escope = require('escope'); var function(str, p1, pos) { hasGritData = true; gritData[pos] = str.substring(0, str.length - 1); // Cut 4 characters to save correct line/column info for surrounding code return '/*' + str.slice(4) + '*/'; }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = requi{··· tree.comments[0].type = 'Hashbang'; tree.comments[0].value = '#!' + tree.comments[0].value; } |
| ✓ Negative was executed (else) | var a··· if (hasInstrumentationData) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· { tree.comments.forEach(function(token) { var rangeStart = token.range[0]; if (instrumentationData.hasOwnProperty(rangeStart)) { token.type = 'InstrumentationDirective'; token.value = instrumentationData[rangeStart]; } }); } |
| ✓ Negative was executed (else) | var a··· if (hasGritData) { |
| Function (anonymous_164) | |
|---|---|
| ✓ Was called | var assert = require('assert')function(token) {··· var rangeStart = token.range[0]; if (instrumentationData.hasOwnProperty(rangeStart)) { token.type = 'InstrumentationDirective'; token.value = instrumentationData[rangeStart]; } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var escope = require('escope');{ token.type = 'InstrumentationDirective'; token.value = instrumentationData[rangeStart]; } |
| ✓ Negative was executed (else) | var assert = ··· }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require({··· tree.comments.forEach(function(token) { var rangeStart = token.range[0]; if (gritData.hasOwnProperty(rangeStart)) { token.type = 'GritTag'; token.value = gritData[rangeStart]; } }); } |
| ✓ Negative was executed (else) | var a··· return tree; |
| Function (anonymous_165) | |
|---|---|
| ✓ Was called | var assert = require('assert')function(token) {··· var rangeStart = token.range[0]; if (gritData.hasOwnProperty(rangeStart)) { token.type = 'GritTag'; token.value = gritData[rangeStart]; } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var escope = require{ token.type = 'GritTag'; token.value = gritData[rangeStart]; } |
| ✗ Negative was not executed (else) | var assert = ··· }); |
| Function iterate | |
|---|---|
| ✓ Was called | var estraverse = require(function iterate(node, cb) {··· if ('type' in node) { estraverse.traverse(node, { enter: function(node, parent) { var parentCollection = []; // parentCollection support var path = this.path(); if (path) { var collectionKey; while (path.length > 0) { var pathElement = path.pop(); if (typeof pathElement === 'string') { collectionKey = pathElement; break; } } parentCollection = parent[collectionKey]; if (!Array.isArray(parentCollection)) { parentCollection = [parentCollection]; } } if (cb(node, parent, parentCollection) === false) { return estraverse.VisitorOption.Skip; } }, keys: keys }); } }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var estraverse = require{··· estraverse.traverse(node, { enter: function(node, parent) { var parentCollection = []; // parentCollection support var path = this.path(); if (path) { var collectionKey; while (path.length > 0) { var pathElement = path.pop(); if (typeof pathElement === 'string') { collectionKey = pathElement; break; } } parentCollection = parent[collectionKey]; if (!Array.isArray(parentCollection)) { parentCollection = [parentCollection]; } } if (cb(node, parent, parentCollection) === false) { return estraverse.VisitorOption.Skip; } }, keys: keys }); } |
| ✓ Negative was executed (else) | var e··· }; |
| Function (anonymous_167) | |
|---|---|
| ✓ Was called | var estraverse = refunction(node, parent) {··· var parentCollection = []; // parentCollection support var path = this.path(); if (path) { var collectionKey; while (path.length > 0) { var pathElement = path.pop(); if (typeof pathElement === 'string') { collectionKey = pathElement; break; } } parentCollection = parent[collectionKey]; if (!Array.isArray(parentCollection)) { parentCollection = [parentCollection]; } } if (cb(node, parent, parentCollection) === false) { return estraverse.VisitorOption.Skip; } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var estraverse = require('{··· var collectionKey; while (path.length > 0) { var pathElement = path.pop(); if (typeof pathElement === 'string') { collectionKey = pathElement; break; } } parentCollection = parent[collectionKey]; if (!Array.isArray(parentCollection)) { parentCollection = [parentCollection]; } } |
| ✓ Negative was executed (else) | var estraverse = ··· if (cb(node, parent, parentCollection) === false) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var estraverse = require('estraverse');··· var assign = require({ collectionKey = pathElement; break; } |
| ✓ Negative was executed (else) | var estraverse = require(··· } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var estraverse = require('estraverse');··· var assign = requi{ parentCollection = [parentCollection]; } |
| ✓ Negative was executed (else) | var estraverse = requ··· } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var estraverse = require('estraverse');··· var assign = require('loda{ return estraverse.VisitorOption.Skip; } |
| ✓ Negative was executed (else) | var estraverse = ··· }, |
| Function Configuration | |
|---|---|
| ✓ Was called | function Configuration() {··· /** * List of the registered (not used) presets. * * @protected * @type {Object} */ this._presets = {}; /** * Name of the preset (if used). * * @protected * @type {String|null} */ this._presetName = null; /** * List of loaded presets. * * @protected * @type {String|null} */ this._loadedPresets = []; /** * List of rules instances. * * @protected * @type {Object} */ this._rules = {}; /** * List of configurated rule instances. * * @protected * @type {Object} */ this._ruleSettings = {}; /** * List of configured rules. * * @protected * @type {Array} */ this._configuredRules = []; /** * List of unsupported rules. * * @protected * @type {Array} */ this._unsupportedRuleNames = []; /** * File extensions that would be checked. * * @protected * @type {Array} */ this._fileExtensions = []; /** * Default file extensions that would be checked. * * @protected * @type {Array} */ this._defaultFileExtensions = ['.js']; /** * Exclusion masks. * * @protected * @type {Array} */ this._excludedFileMasks = []; /** * Default exclusion masks, will be rewritten if user has their own masks. * * @protected * @type {Array} */ this._defaultExcludedFileMasks = ['.git/**', 'node_modules/**']; /** * List of existing files that falls under exclusion masks. * * @protected * @type {Array} */ this._excludedFileMatchers = []; /** * Extraction masks. * * @protected * @type {Array} */ this._extractFileMasks = []; /** * Default extractions masks. * * @protected * @type {Array} */ this._defaultExtractFileMasks = ['**/*.+(htm|html|xhtml)']; /** * List of file matchers from which to extract JavaScript. * * @protected * @type {Array} */ this._extractFileMatchers = []; /** * Maxixum amount of error that would be reportered. * * @protected * @type {Number} */ this._maxErrors = defaults.maxErrors; /** * JSCS CWD. * * @protected * @type {String} */ this._basePath = defaults.cwd; /** * List of overrided options (usually from CLI). * * @protected * @type {Object} */ this._overrides = {}; /** * Is "esnext" mode enabled? * * @protected * @type {Boolean} */ this._esnextEnabled = false; /** * Is "ES3" mode enabled?. * * @protected * @type {Boolean} */ this._es3Enabled = false; /** * Custom version of esprima if specified. * * @protected * @type {Object|null} */ this._esprima = null; /** * Options that would be passed to esprima. * * @protected * @type {Object} */ this._esprimaOptions = {}; /** * A filter function that determines whether or not to report an error. * * @protected * @type {Function|null} */ this._errorFilter = null; /** * Should we show rule names in error output? * * @protected * @type {Boolean} */ this._verbose = false; } |
| Function (anonymous_169) | |
|---|---|
| ✓ Was called | var assert = require('assert');function(config) {··· // Apply all the options this._processConfig(config); // Load and apply all the rules this._useRules(); }; |
| Function (anonymous_170) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var path = refunction() { var result = {}; Object.keys(this._ruleSettings).forEach(function(key) { result[key] = this._ruleSettings[key]; }, this); result.excludeFiles = this._excludedFileMasks; result.fileExtensions = this._fileExtensions; result.extract = this._extractFileMasks; result.maxErrors = this._maxErrors; result.preset = this._presetName; result.esnext = this._esnextEnabled; result.es3 = this._es3Enabled; result.esprima = this._esprima; result.esprimaOptions = this._esprimaOptions; result.errorFilter = this._errorFilter; return result; }; |
| Function (anonymous_171) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var path = rfunction(key) { result[key] = this._ruleSettings[key]; }, this); |
| Function (anonymous_172) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var path = refunction() { return this._configuredRules; }; |
| Function (anonymous_173) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var path = rfunction(name) { return this._configuredRules.filter(function(rule) { return rule.getOptionName() === name; })[0] || null; }; |
| Function (anonymous_174) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var pathfunction(rule) { return rule.getOptionName() === name; })[0] || null; |
| Branch LogicalExpression | |
| ✓ Was returned | var assert = null; |
| ✓ Was returned | var assert this._configuredRules.filter(function(rule) {··· return rule.getOptionName() === name; })[0] || null; |
| Function (anonymous_175) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var path = requirefunction() { return this._unsupportedRuleNames; }; |
| Function (anonymous_176) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var path = requfunction() { return this._excludedFileMasks; }; |
| Function (anonymous_177) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var path function(filePath) { filePath = path.resolve(filePath); return this._excludedFileMatchers.some(function(matcher) { return matcher.match(filePath); }); }; |
| Function (anonymous_178) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var path = function(matcher) { return matcher.match(filePath); }); |
| Function (anonymous_179) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var path = rfunction() { return this._fileExtensions; }; |
| Function (anonymous_180) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var path = reqfunction() { return this._extractFileMasks; }; |
| Function (anonymous_181) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var path = rfunction(filePath) { filePath = path.resolve(filePath); return this._extractFileMatchers.some(function(matcher) { return matcher.match(filePath); }); }; |
| Function (anonymous_182) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var path =function(matcher) { return matcher.match(filePath); }); |
| Function (anonymous_183) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var patfunction() { return this._maxErrors; }; |
| Function (anonymous_184) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· vfunction() { return !!this._fix; }; |
| Function (anonymous_185) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var path =function() { return this._esnextEnabled; }; |
| Function (anonymous_186) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var patfunction() { return this._es3Enabled; }; |
| Function (anonymous_187) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var path = function() { return !!this._esprima; }; |
| Function (anonymous_188) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var path = function() { return this._esprima; }; |
| Function (anonymous_189) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var pfunction() { return this._verbose || false; }; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var assert = require('assertfalse; |
| ✓ Was returned | var assert this._verbose || false; |
| Function (anonymous_190) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var path = rfunction() { return this._esprimaOptions; }; |
| Function (anonymous_191) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var path function() { return this._errorFilter; }; |
| Function (anonymous_192) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var pafunction() { return this._basePath; }; |
| Function (anonymous_193) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· varfunction(overrides) { Object.keys(overrides).forEach(function(key) { this._overrides[key] = overrides[key]; }, this); }; |
| Function (anonymous_194) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· varfunction(key) { this._overrides[key] = overrides[key]; }, this); |
| Function (anonymous_195) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var path = requifunction(config) { return Object.keys(config).reduce(function(options, key) { if (BUILTIN_OPTIONS[key]) { options[key] = config[key]; } return options; }, {}); }; |
| Function (anonymous_196) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var pafunction(options, key) { if (BUILTIN_OPTIONS[key]) { options[key] = config[key]; } return options; }, {}); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· va{ options[key] = config[key]; } |
| ✓ Negative was executed (else) | var asser··· return options; |
| Function (anonymous_197) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var path function(config) { var overrides = this._overrides; var currentConfig = {}; // Copy configuration so original config would be intact copyConfiguration(config, currentConfig); // Override the properties copyConfiguration(overrides, currentConfig); // NOTE: options is a separate object to ensure that future options must be added // to BUILTIN_OPTIONS to work, which also assures they aren't mistaken for a rule var options = this._getOptionsFromConfig(currentConfig); // Base path if (this._basePath === defaults.cwd && options.configPath) { assert( typeof options.configPath === 'string', '`configPath` option requires string value' ); this._basePath = path.dirname(options.configPath); } if (options.hasOwnProperty('plugins')) { assert(Array.isArray(options.plugins), '`plugins` option requires array value'); options.plugins.forEach(function(plugin) { this._loadPlugin(plugin, options.configPath); }, this); } if (options.hasOwnProperty('additionalRules')) { assert(Array.isArray(options.additionalRules), '`additionalRules` option requires array value'); options.additionalRules.forEach(function(rule) { this._loadAdditionalRule(rule, options.configPath); }, this); } if (options.hasOwnProperty('extract')) { this._loadExtract(options.extract); } if (options.hasOwnProperty('fileExtensions')) { this._loadFileExtensions(options.fileExtensions); // Set default extensions if there is no presets that could define their own } else if (!options.hasOwnProperty('preset')) { this._loadFileExtensions(this._defaultFileExtensions); } if (options.hasOwnProperty('excludeFiles')) { this._loadExcludedFiles(options.excludeFiles); // Set default masks if there is no presets that could define their own } else if (!options.hasOwnProperty('preset')) { this._loadExcludedFiles(this._defaultExcludedFileMasks); } if (options.hasOwnProperty('fix')) { this._loadFix(options.fix); } this._loadMaxError(options); if (options.hasOwnProperty('esnext')) { this._loadESNext(options.esnext); } if (options.hasOwnProperty('es3')) { this._loadES3(options.es3); } if (options.hasOwnProperty('esprima')) { this._loadEsprima(options.esprima, options.configPath); } if (options.hasOwnProperty('esprimaOptions')) { this._loadEsprimaOptions(options.esprimaOptions); } if (options.hasOwnProperty('errorFilter')) { this._loadErrorFilter(options.errorFilter, options.configPath); } if (options.hasOwnProperty('verbose')) { this._loadVerbose(options.verbose); } // Apply presets if (options.hasOwnProperty('preset')) { this._loadPreset(options.preset, options.configPath); } this._loadRules(currentConfig); }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var path = require('path'); va{ assert( typeof options.configPath === 'string', '`configPath` option requires string value' ); this._basePath = path.dirname(options.configPath); } |
| ✓ Negative was executed (else) | var a··· if (options.hasOwnProperty('plugins')) { |
| Branch LogicalExpression | |
| ✓ Was returned | var assert = require('assert');··· var path = options.configPath) { |
| ✓ Was returned | var assethis._basePath === defaults.cwd && options.configPath) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var path = { assert(Array.isArray(options.plugins), '`plugins` option requires array value'); options.plugins.forEach(function(plugin) { this._loadPlugin(plugin, options.configPath); }, this); } |
| ✓ Negative was executed (else) | var a··· if (options.hasOwnProperty('additionalRules')) { |
| Function (anonymous_198) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· function(plugin) { this._loadPlugin(plugin, options.configPath); }, this); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var path = require({ assert(Array.isArray(options.additionalRules), '`additionalRules` option requires array value'); options.additionalRules.forEach(function(rule) { this._loadAdditionalRule(rule, options.configPath); }, this); } |
| ✓ Negative was executed (else) | var a··· if (options.hasOwnProperty('extract')) { |
| Function (anonymous_199) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var pathfunction(rule) { this._loadAdditionalRule(rule, options.configPath); }, this); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var path = { this._loadExtract(options.extract); } |
| ✓ Negative was executed (else) | var a··· if (options.hasOwnProperty('fileExtensions')) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var path = require{ this._loadFileExtensions(options.fileExtensions); // Set default extensions if there is no presets that could define their own } else if (!options.hasOwnProperty('preset')) { |
| ✓ Negative was executed (else) | var assert if (!options.hasOwnProperty('preset')) {··· this._loadFileExtensions(this._defaultFileExtensions); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var path = require{ this._loadFileExtensions(this._defaultFileExtensions); } |
| ✓ Negative was executed (else) | var a··· if (options.hasOwnProperty('excludeFiles')) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var path = requi{ this._loadExcludedFiles(options.excludeFiles); // Set default masks if there is no presets that could define their own } else if (!options.hasOwnProperty('preset')) { |
| ✓ Negative was executed (else) | var assert if (!options.hasOwnProperty('preset')) {··· this._loadExcludedFiles(this._defaultExcludedFileMasks); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var path = require{ this._loadExcludedFiles(this._defaultExcludedFileMasks); } |
| ✓ Negative was executed (else) | var a··· if (options.hasOwnProperty('fix')) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var pat{ this._loadFix(options.fix); } |
| ✓ Negative was executed (else) | var a··· this._loadMaxError(options); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var path ={ this._loadESNext(options.esnext); } |
| ✓ Negative was executed (else) | var a··· if (options.hasOwnProperty('es3')) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var pat{ this._loadES3(options.es3); } |
| ✓ Negative was executed (else) | var a··· if (options.hasOwnProperty('esprima')) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var path = { this._loadEsprima(options.esprima, options.configPath); } |
| ✓ Negative was executed (else) | var a··· if (options.hasOwnProperty('esprimaOptions')) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var path = require{ this._loadEsprimaOptions(options.esprimaOptions); } |
| ✓ Negative was executed (else) | var a··· if (options.hasOwnProperty('errorFilter')) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var path = requ{ this._loadErrorFilter(options.errorFilter, options.configPath); } |
| ✓ Negative was executed (else) | var a··· if (options.hasOwnProperty('verbose')) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var path = { this._loadVerbose(options.verbose); } |
| ✓ Negative was executed (else) | var a··· // Apply presets |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var path ={ this._loadPreset(options.preset, options.configPath); } |
| ✓ Negative was executed (else) | var a··· this._loadRules(currentConfig); |
| Function (anonymous_200) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var pafunction(plugin) { assert(typeof plugin === 'function', '`plugin` should be a function'); plugin(this); }; |
| Function (anonymous_201) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var pfunction(config) { Object.keys(config).forEach(function(key) { // Only rules should be processed if (BUILTIN_OPTIONS[key]) { return; } if (this._rules[key]) { var optionValue = config[key]; // Disable rule it it equals "false" or "null" if (optionValue === null || optionValue === false) { delete this._ruleSettings[key]; } else { this._ruleSettings[key] = config[key]; } } else if (this._unsupportedRuleNames.indexOf(key) === -1) { this._unsupportedRuleNames.push(key); } }, this); }; |
| Function (anonymous_202) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· function(key) { // Only rules should be processed if (BUILTIN_OPTIONS[key]) { return; } if (this._rules[key]) { var optionValue = config[key]; // Disable rule it it equals "false" or "null" if (optionValue === null || optionValue === false) { delete this._ruleSettings[key]; } else { this._ruleSettings[key] = config[key]; } } else if (this._unsupportedRuleNames.indexOf(key) === -1) { this._unsupportedRuleNames.push(key); } }, this); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· va{ return; } |
| ✓ Negative was executed (else) | var asser··· if (this._rules[key]) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert'){··· var optionValue = config[key]; // Disable rule it it equals "false" or "null" if (optionValue === null || optionValue === false) { delete this._ruleSettings[key]; } else { this._ruleSettings[key] = config[key]; } } else if (this._unsupportedRuleNames.indexOf(key) === -1) { |
| ✓ Negative was executed (else) | var assert = reif (this._unsupportedRuleNames.indexOf(key) === -1) {··· this._unsupportedRuleNames.push(key); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var path = require('path'); va{ delete this._ruleSettings[key]; } else { |
| ✓ Negative was executed (else) | var assert = requir{··· this._ruleSettings[key] = config[key]; } |
| Branch LogicalExpression | |
| ✓ Was returned | var assert = require('assert');··· var pathoptionValue === false) { |
| ✓ Was returned | var assert = reqoptionValue === null || optionValue === false) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var path = require('path'); var mi{ this._unsupportedRuleNames.push(key); } |
| ✓ Negative was executed (else) | var asser··· }, this); |
| Function (anonymous_203) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var path = function(errorFilter) { assert( typeof errorFilter === 'function' || errorFilter === null, '`errorFilter` option requires a function or null value' ); this._errorFilter = errorFilter; }; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var asseerrorFilter === null, |
| ✓ Was returned | var assetypeof errorFilter === 'function' || |
| Function (anonymous_204) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var patfunction(verbose) { assert( typeof verbose === 'boolean' || verbose === null, '`verbose` option requires a boolean or null value' ); this._verbose = verbose; }; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var assert = require('assert');··· var pathverbose === null, |
| ✓ Was returned | var assetypeof verbose === 'boolean' || verbose === null, |
| Function (anonymous_205) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var pafunction(esnext) { assert( typeof esnext === 'boolean' || esnext === null, '`esnext` option requires boolean or null value' ); this._esnextEnabled = Boolean(esnext); }; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var assert = require('assert');··· var patesnext === null, |
| ✓ Was returned | var assetypeof esnext === 'boolean' || esnext === null, |
| Function (anonymous_206) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· varfunction(es3) { assert( typeof es3 === 'boolean' || es3 === null, '`es3` option requires boolean or null value' ); this._es3Enabled = Boolean(es3); }; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var assert = require('assert');··· var es3 === null, |
| ✓ Was returned | var assetypeof es3 === 'boolean' || es3 === null, |
| Function (anonymous_207) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var pathfunction(options) { // If "fix" option is enabled, set to Inifinity, otherwise this option // doesn't make sense with "fix" conjunction if (this._fix === true) { this._maxErrors = Infinity; return; } if (!options.hasOwnProperty('maxErrors')) { return; } var maxErrors = options.maxErrors === null ? null : Number(options.maxErrors); assert( maxErrors === -1 || maxErrors > 0 || maxErrors === null, '`maxErrors` option requires -1, null value or positive number' ); this._maxErrors = maxErrors; }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert{··· this._maxErrors = Infinity; return; } |
| ✓ Negative was executed (else) | var a··· if (!options.hasOwnProperty('maxErrors')) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var path = req{ return; } |
| ✓ Negative was executed (else) | var a··· var maxErrors = options.maxErrors === null ? null : Number(options.maxErrors); |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | var assert = require('assert');··· var path = requirnull : Number(options.maxErrors); |
| ✓ Negative was returned (: ...) | var assert = require('assert');··· var path = require('pathNumber(options.maxErrors); |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var assert = require('assert');··· var path = remaxErrors === null, |
| ✓ Was returned | var assemaxErrors === -1 || maxErrors > 0 || maxErrors === null, |
| Branch LogicalExpression | |
| ✓ Was returned | var assert = require('assertmaxErrors > 0 || maxErrors === null, |
| ✗ Was not returned | var assemaxErrors === -1 || maxErrors > 0 || maxErrors === null, |
| Function (anonymous_208) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· varfunction(fix) { fix = fix === null ? false : fix; assert( typeof fix === 'boolean', '`fix` option requires boolean or null value' ); this._fix = fix; }; |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | var assert = require('assfalse : fix; |
| ✓ Negative was returned (: ...) | var assert = require('assert');··· vfix; |
| Function (anonymous_209) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var patfunction(esprima) { assert( (esprima && typeof esprima.parse === 'function') || esprima === null, '`esprima` option requires a null value or an object with a parse function' ); this._esprima = esprima; }; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var asseesprima === null, |
| ✓ Was returned | var asseresprima && typeof esprima.parse === 'function') || |
| Branch LogicalExpression | |
| ✓ Was returned | var assert = requiretypeof esprima.parse === 'function') || |
| ✗ Was not returned | var asseresprima && typeof esprima.parse === 'function') || |
| Function (anonymous_210) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var pafunction(preset) { if (this._loadedPresets.indexOf(preset) > -1) { return; } // Do not keep adding preset from CLI (#2087) delete this._overrides.preset; this._loadedPresets.push(preset); // If preset is loaded from another preset - preserve the original name if (!this._presetName) { this._presetName = preset; } assert(typeof preset === 'string', '`preset` option requires string value'); var presetData = this._presets[preset]; assert(Boolean(presetData), 'Preset "' + preset + '" does not exist'); // Process config from the preset this._processConfig(this._presets[preset]); }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var path = require{ return; } |
| ✓ Negative was executed (else) | var a··· // Do not keep adding preset from CLI (#2087) |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('asser{··· this._presetName = preset; } |
| ✓ Negative was executed (else) | var a··· assert(typeof preset === 'string', '`preset` option requires string value'); |
| Function (anonymous_211) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var path = reqfunction(extensions) { assert( typeof extensions === 'string' || Array.isArray(extensions), '`fileExtensions` option requires string or array value' ); this._fileExtensions = this._fileExtensions.concat(extensions).map(function(ext) { return ext.toLowerCase(); }); }; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var assert = require('assert');··· var path =Array.isArray(extensions), |
| ✓ Was returned | var assetypeof extensions === 'string' || Array.isArray(extensions), |
| Function (anonymous_212) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var path = require('path'); var minimafunction(ext) { return ext.toLowerCase(); }); |
| Function (anonymous_213) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var path = refunction(masks) { assert(Array.isArray(masks), '`excludeFiles` option requires array value'); this._excludedFileMasks = this._excludedFileMasks.concat(masks); this._excludedFileMatchers = this._excludedFileMasks.map(function(fileMask) { return new minimatch.Minimatch(path.resolve(this._basePath, fileMask), { dot: true }); }, this); }; |
| Function (anonymous_214) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var path = require('path'); function(fileMask) { return new minimatch.Minimatch(path.resolve(this._basePath, fileMask), { dot: true }); }, this); |
| Function (anonymous_215) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var patfunction(masks) { if (masks === true) { masks = this._defaultExtractFileMasks; } else if (masks === false) { masks = []; } assert(Array.isArray(masks), '`extract` option should be array of strings'); this._extractFileMasks = masks.slice(); this._extractFileMatchers = this._extractFileMasks.map(function(fileMask) { return new minimatch.Minimatch(path.resolve(this._basePath, fileMask), { dot: true }); }, this); }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('as{··· masks = this._defaultExtractFileMasks; } else if (masks === false) { |
| ✓ Negative was executed (else) | var assert if (masks === false) {··· masks = []; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· { masks = []; } |
| ✓ Negative was executed (else) | var a··· assert(Array.isArray(masks), '`extract` option should be array of strings'); |
| Function (anonymous_216) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var path = require('path');function(fileMask) { return new minimatch.Minimatch(path.resolve(this._basePath, fileMask), { dot: true }); }, this); |
| Function (anonymous_217) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var path = reqfunction(esprimaOptions) { assert(typeof esprimaOptions === 'object' && esprimaOptions !== null, '`esprimaOptions` should be an object'); this._esprimaOptions = esprimaOptions; }; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var assert = require('assert');··· var path = requiresprimaOptions !== null, '`esprimaOptions` should be an object'); |
| ✓ Was returned | var assert typeof esprimaOptions === 'object' && esprimaOptions !== null, '`esprimaOptions` should be an object'); |
| Function (anonymous_218) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var path = reqfunction(additionalRule) { assert(typeof additionalRule === 'object', '`additionalRule` should be an object'); this.registerRule(additionalRule); }; |
| Function (anonymous_219) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var function(plugin) { this._loadPlugin(plugin); }; |
| Function (anonymous_220) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var function() { this._configuredRules = []; Object.keys(this._ruleSettings).forEach(function(optionName) { var rule = this._rules[optionName]; rule.configure(this._ruleSettings[optionName]); this._configuredRules.push(rule); }, this); }; |
| Function (anonymous_221) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var path = rfunction(optionName) { var rule = this._rules[optionName]; rule.configure(this._ruleSettings[optionName]); this._configuredRules.push(rule); }, this); |
| Function (anonymous_222) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var patfunction(rule) { if (typeof rule === 'function') { var RuleClass = rule; rule = new RuleClass(); } var optionName = rule.getOptionName(); assert(!this._rules.hasOwnProperty(optionName), 'Rule "' + optionName + '" is already registered'); this._rules[optionName] = rule; }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var { var RuleClass = rule; rule = new RuleClass(); } |
| ✓ Negative was executed (else) | var a··· var optionName = rule.getOptionName(); |
| Function (anonymous_223) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var path = refunction() { var rules = this._rules; return Object.keys(rules).map(function(ruleOptionName) { return rules[ruleOptionName]; }); }; |
| Function (anonymous_224) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· vafunction(ruleOptionName) { return rules[ruleOptionName]; }); |
| Function (anonymous_225) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var path function(presetName, presetConfig) { assert(_.isPlainObject(presetConfig), 'Preset should be an object'); for (var key in presetConfig) { assert(typeof presetConfig[key] !== 'function', 'Preset should be an JSON object'); } this._presets[presetName] = presetConfig; }; |
| Function (anonymous_226) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var path = requfunction() { return this._presets; }; |
| Function (anonymous_227) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var function(presetName) { return this._presets.hasOwnProperty(presetName); }; |
| Function (anonymous_228) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var pathfunction() { return this._presetName; }; |
| Function (anonymous_229) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var path = requfunction() { /* Important! These rules are linked explicitly to keep browser-version supported. */ this.registerRule(require('../rules/disallow-unused-params')); // Register jsdoc plugin this.registerRule(require('../rules/jsdoc')); /* ES6 only */ this.registerRule(require('../rules/require-parentheses-around-arrow-param')); this.registerRule(require('../rules/disallow-parentheses-around-arrow-param')); this.registerRule(require('../rules/require-numeric-literals')); this.registerRule(require('../rules/require-arrow-functions')); this.registerRule(require('../rules/disallow-arrow-functions')); this.registerRule(require('../rules/require-spread')); this.registerRule(require('../rules/require-template-strings')); this.registerRule(require('../rules/require-shorthand-arrow-functions')); this.registerRule(require('../rules/disallow-shorthand-arrow-functions')); this.registerRule(require('../rules/disallow-identical-destructuring-names')); this.registerRule(require('../rules/require-spaces-in-generator')); this.registerRule(require('../rules/disallow-spaces-in-generator')); this.registerRule(require('../rules/require-object-destructuring')); this.registerRule(require('../rules/require-enhanced-object-literals')); this.registerRule(require('../rules/require-array-destructuring')); this.registerRule(require('../rules/disallow-var')); /* ES6 only (end) */ this.registerRule(require('../rules/require-curly-braces')); this.registerRule(require('../rules/disallow-curly-braces')); this.registerRule(require('../rules/require-multiple-var-decl')); this.registerRule(require('../rules/disallow-multiple-var-decl')); this.registerRule(require('../rules/require-var-decl-first')); this.registerRule(require('../rules/disallow-empty-blocks')); this.registerRule(require('../rules/require-space-after-keywords')); this.registerRule(require('../rules/require-space-before-keywords')); this.registerRule(require('../rules/disallow-space-after-keywords')); this.registerRule(require('../rules/disallow-space-before-keywords')); this.registerRule(require('../rules/require-parentheses-around-iife')); this.registerRule(require('../rules/require-operator-before-line-break')); this.registerRule(require('../rules/disallow-operator-before-line-break')); this.registerRule(require('../rules/disallow-implicit-type-conversion')); this.registerRule(require('../rules/require-camelcase-or-uppercase-identifiers')); this.registerRule(require('../rules/disallow-keywords')); this.registerRule(require('../rules/disallow-multiple-line-breaks')); this.registerRule(require('../rules/disallow-multiple-line-strings')); this.registerRule(require('../rules/disallow-multiple-spaces')); this.registerRule(require('../rules/validate-line-breaks')); this.registerRule(require('../rules/validate-quote-marks')); this.registerRule(require('../rules/validate-indentation')); this.registerRule(require('../rules/disallow-trailing-whitespace')); this.registerRule(require('../rules/disallow-mixed-spaces-and-tabs')); this.registerRule(require('../rules/require-object-keys-on-new-line')); this.registerRule(require('../rules/disallow-object-keys-on-new-line')); this.registerRule(require('../rules/require-keywords-on-new-line')); this.registerRule(require('../rules/disallow-keywords-on-new-line')); this.registerRule(require('../rules/require-line-feed-at-file-end')); this.registerRule(require('../rules/maximum-line-length')); this.registerRule(require('../rules/require-yoda-conditions')); this.registerRule(require('../rules/disallow-yoda-conditions')); this.registerRule(require('../rules/require-spaces-inside-brackets')); this.registerRule(require('../rules/require-spaces-inside-object-brackets')); this.registerRule(require('../rules/require-spaces-inside-array-brackets')); this.registerRule(require('../rules/require-spaces-inside-parentheses')); this.registerRule(require('../rules/require-spaces-inside-parenthesized-expression')); this.registerRule(require('../rules/disallow-spaces-inside-brackets')); this.registerRule(require('../rules/disallow-spaces-inside-object-brackets')); this.registerRule(require('../rules/disallow-spaces-inside-array-brackets')); this.registerRule(require('../rules/disallow-spaces-inside-parentheses')); this.registerRule(require('../rules/disallow-spaces-inside-parenthesized-expression')); this.registerRule(require('../rules/require-blocks-on-newline')); this.registerRule(require('../rules/require-space-after-object-keys')); this.registerRule(require('../rules/require-space-before-object-values')); this.registerRule(require('../rules/disallow-space-after-object-keys')); this.registerRule(require('../rules/disallow-space-before-object-values')); this.registerRule(require('../rules/disallow-quoted-keys-in-objects')); this.registerRule(require('../rules/require-quoted-keys-in-objects')); this.registerRule(require('../rules/disallow-dangling-underscores')); this.registerRule(require('../rules/require-aligned-object-values')); this.registerRule(require('../rules/validate-aligned-function-parameters')); this.registerRule(require('../rules/disallow-padding-newlines-after-blocks')); this.registerRule(require('../rules/require-padding-newlines-after-blocks')); this.registerRule(require('../rules/disallow-padding-newlines-in-blocks')); this.registerRule(require('../rules/require-padding-newlines-in-blocks')); this.registerRule(require('../rules/require-padding-newlines-in-objects')); this.registerRule(require('../rules/disallow-padding-newlines-in-objects')); this.registerRule(require('../rules/require-newline-before-block-statements')); this.registerRule(require('../rules/disallow-newline-before-block-statements')); this.registerRule(require('../rules/require-padding-newlines-before-keywords')); this.registerRule(require('../rules/disallow-padding-newlines-before-keywords')); this.registerRule(require('../rules/disallow-padding-newlines-before-line-comments')); this.registerRule(require('../rules/require-padding-newlines-before-line-comments')); this.registerRule(require('../rules/validate-comment-position.js')); this.registerRule(require('../rules/disallow-trailing-comma')); this.registerRule(require('../rules/require-trailing-comma')); this.registerRule(require('../rules/require-dollar-before-jquery-assignment')); this.registerRule(require('../rules/disallow-comma-before-line-break')); this.registerRule(require('../rules/require-comma-before-line-break')); this.registerRule(require('../rules/disallow-space-before-block-statements.js')); this.registerRule(require('../rules/require-space-before-block-statements.js')); this.registerRule(require('../rules/disallow-space-before-postfix-unary-operators.js')); this.registerRule(require('../rules/require-space-before-postfix-unary-operators.js')); this.registerRule(require('../rules/disallow-space-after-prefix-unary-operators.js')); this.registerRule(require('../rules/require-space-after-prefix-unary-operators.js')); this.registerRule(require('../rules/disallow-space-before-binary-operators')); this.registerRule(require('../rules/require-space-before-binary-operators')); this.registerRule(require('../rules/disallow-space-after-binary-operators')); this.registerRule(require('../rules/require-space-after-binary-operators')); this.registerRule(require('../rules/require-spaces-in-conditional-expression')); this.registerRule(require('../rules/disallow-spaces-in-conditional-expression')); this.registerRule(require('../rules/require-multi-line-ternary')); this.registerRule(require('../rules/disallow-multi-line-ternary')); this.registerRule(require('../rules/disallow-nested-ternaries')); this.registerRule(require('../rules/require-spaces-in-function')); this.registerRule(require('../rules/disallow-spaces-in-function')); this.registerRule(require('../rules/require-spaces-in-function-expression')); this.registerRule(require('../rules/disallow-spaces-in-function-expression')); this.registerRule(require('../rules/require-spaces-in-anonymous-function-expression')); this.registerRule(require('../rules/disallow-spaces-in-anonymous-function-expression')); this.registerRule(require('../rules/require-spaces-in-named-function-expression')); this.registerRule(require('../rules/disallow-spaces-in-named-function-expression')); this.registerRule(require('../rules/require-spaces-in-function-declaration')); this.registerRule(require('../rules/disallow-spaces-in-function-declaration')); this.registerRule(require('../rules/require-spaces-in-call-expression')); this.registerRule(require('../rules/disallow-spaces-in-call-expression')); this.registerRule(require('../rules/validate-parameter-separator')); this.registerRule(require('../rules/require-space-between-arguments')); this.registerRule(require('../rules/disallow-space-between-arguments')); this.registerRule(require('../rules/require-capitalized-constructors')); this.registerRule(require('../rules/require-capitalized-constructors-new')); this.registerRule(require('../rules/safe-context-keyword')); this.registerRule(require('../rules/require-dot-notation')); this.registerRule(require('../rules/require-space-after-line-comment')); this.registerRule(require('../rules/disallow-space-after-line-comment')); this.registerRule(require('../rules/require-anonymous-functions')); this.registerRule(require('../rules/disallow-anonymous-functions')); this.registerRule(require('../rules/require-named-unassigned-functions')); this.registerRule(require('../rules/disallow-named-unassigned-functions')); this.registerRule(require('../rules/require-function-declarations')); this.registerRule(require('../rules/disallow-function-declarations')); this.registerRule(require('../rules/require-capitalized-comments')); this.registerRule(require('../rules/disallow-capitalized-comments')); this.registerRule(require('../rules/require-line-break-after-variable-assignment')); this.registerRule(require('../rules/require-padding-newline-after-variable-declaration')); this.registerRule(require('../rules/disallow-padding-newlines-after-use-strict')); this.registerRule(require('../rules/require-padding-newlines-after-use-strict')); this.registerRule(require('../rules/disallow-padding-newlines-before-export')); this.registerRule(require('../rules/require-padding-newlines-before-export')); this.registerRule(require('../rules/require-semicolons')); this.registerRule(require('../rules/disallow-semicolons')); this.registerRule(require('../rules/require-spaces-in-for-statement')); this.registerRule(require('../rules/disallow-spaces-in-for-statement')); this.registerRule(require('../rules/disallow-node-types')); this.registerRule(require('../rules/disallow-keywords-in-comments')); this.registerRule(require('../rules/disallow-identifier-names')); this.registerRule(require('../rules/maximum-number-of-lines')); this.registerRule(require('../rules/validate-newline-after-array-elements')); this.registerRule(require('../rules/disallow-not-operators-in-conditionals')); this.registerRule(require('../rules/require-matching-function-name')); this.registerRule(require('../rules/disallow-space-before-semicolon')); this.registerRule(require('../rules/disallow-space-before-comma')); this.registerRule(require('../rules/disallow-space-after-comma')); this.registerRule(require('../rules/require-space-before-comma')); this.registerRule(require('../rules/require-space-after-comma')); this.registerRule(require('../rules/validate-order-in-object-keys')); this.registerRule(require('../rules/disallow-tabs')); this.registerRule(require('../rules/require-aligned-multiline-params')); this.registerRule(require('../rules/require-early-return')); }; |
| Function (anonymous_230) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· var path = requirfunction() { // https://github.com/airbnb/javascript this.registerPreset('airbnb', require('../../presets/airbnb.json')); // http://javascript.crockford.com/code.html this.registerPreset('crockford', require('../../presets/crockford.json')); // https://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml this.registerPreset('google', require('../../presets/google.json')); // http://gruntjs.com/contributing#syntax this.registerPreset('grunt', require('../../presets/grunt.json')); // https://github.com/rwaldron/idiomatic.js#idiomatic-style-manifesto this.registerPreset('idiomatic', require('../../presets/idiomatic.json')); // https://contribute.jquery.org/style-guide/js/ this.registerPreset('jquery', require('../../presets/jquery.json')); // https://github.com/mrdoob/three.js/wiki/Mr.doob's-Code-Style%E2%84%A2 this.registerPreset('mdcs', require('../../presets/mdcs.json')); // https://github.com/felixge/node-style-guide#nodejs-style-guide this.registerPreset('node-style-guide', require('../../presets/node-style-guide.json')); // https://www.mediawiki.org/wiki/Manual:Coding_conventions/JavaScript this.registerPreset('wikimedia', require('jscs-preset-wikimedia')); // https://make.wordpress.org/core/handbook/coding-standards/javascript/ this.registerPreset('wordpress', require('../../presets/wordpress.json')); // https://github.com/yandex/codestyle/blob/master/javascript.md this.registerPreset('yandex', require('../../presets/yandex.json')); }; |
| Function copyConfiguration | |
|---|---|
| ✓ Was called | function copyConfiguration(source, dest) {··· Object.keys(source).forEach(function(key) { dest[key] = source[key]; }); if (source.configPath) { dest.configPath = source.configPath; } } |
| Function (anonymous_232) | |
|---|---|
| ✓ Was called | var assert = require('assert');··· function(key) { dest[key] = source[key]; }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('asser{··· dest.configPath = source.configPath; } |
| ✓ Negative was executed (else) | var a··· } |
| Function (anonymous_233) | |
|---|---|
| ✓ Was called | var htmlparser function(params) {··· this._filename = params.filename; this._lines = params.source.split(rLineSplit); }; |
| Function (anonymous_234) | |
|---|---|
| ✓ Was called | var htmlparser = function() {··· return this._filename; }, |
| Function (anonymous_235) | |
|---|---|
| ✓ Was called | var htmlparserfunction() {··· return this._lines; } |
| Function getScripts | |
|---|---|
| ✓ Was called | function getScripts(html) {··· function onopen(name, attrs) { // tag should be a <script> if (name !== 'script' || // ignore scripts with src attribute attrs.src || // script tag should has no type attribute or attribute should be equal to text/javascript (attrs.type && attrs.type.toLowerCase() !== 'text/javascript')) { return; } // store script content start pos scriptStartPos = parser.endIndex + 1; } function onclose() { if (!scriptStartPos) { return; } // get script content var scriptEndPos = parser.startIndex; var source = html.substring(scriptStartPos, scriptEndPos); // store script content only if it contains non-whitespace characters if (rHasNonWhitespace.test(source)) { scripts.push({ source: source, start: scriptStartPos, end: scriptEndPos }); } // reset script start position scriptStartPos = 0; } var scriptStartPos = 0; var scripts = []; var parser = new htmlparser.Parser({ onopentag: onopen, onclosetag: onclose }); parser.parseComplete(html); return scripts; } |
| Function onopen | |
|---|---|
| ✓ Was called | var function onopen(name, attrs) {··· // tag should be a <script> if (name !== 'script' || // ignore scripts with src attribute attrs.src || // script tag should has no type attribute or attribute should be equal to text/javascript (attrs.type && attrs.type.toLowerCase() !== 'text/javascript')) { return; } // store script content start pos scriptStartPos = parser.endIndex + 1; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var htmlparser = require('htmlparser2');··· var Errors = require('./errors'); v{ return; } |
| ✓ Negative was executed (else) | var htmlp··· // store script content start pos |
| Branch LogicalExpression | |
| ✓ Was returned | var htmlparseattrs.type && attrs.type.toLowerCase() !== 'text/javascript')) { |
| ✓ Was returned | var htmlparsname !== 'script' ||··· // ignore scripts with src attribute attrs.src || |
| Branch LogicalExpression | |
| ✓ Was returned | var htmlparsattrs.src || |
| ✓ Was returned | var htmlparsname !== 'script' || |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var htmlparser = require('hattrs.type.toLowerCase() !== 'text/javascript')) { |
| ✓ Was returned | var htmlparseattrs.type && attrs.type.toLowerCase() !== 'text/javascript')) { |
| Function onclose | |
|---|---|
| ✓ Was called | var function onclose() {··· if (!scriptStartPos) { return; } // get script content var scriptEndPos = parser.startIndex; var source = html.substring(scriptStartPos, scriptEndPos); // store script content only if it contains non-whitespace characters if (rHasNonWhitespace.test(source)) { scripts.push({ source: source, start: scriptStartPos, end: scriptEndPos }); } // reset script start position scriptStartPos = 0; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var htmlparser = require('htm{··· return; } |
| ✓ Negative was executed (else) | var htmlp··· // get script content |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var htmlparser = require('htmlparser2');··· var{ scripts.push({ source: source, start: scriptStartPos, end: scriptEndPos }); } |
| ✓ Negative was executed (else) | var htmlp··· // reset script start position |
| Function normalizeSource | |
|---|---|
| ✓ Was called | function normalizeSource(source) {··· var lines = source.split(rLineSplit); var lineCount = lines.length; var tabOnlyOffset = false; var spaceOnlyOffset = false; var offset; // remove first list if it's an empty string // usually <script> starts with new line if (!rHasNonWhitespace.test(lines[0])) { lines.shift(); } // replace last line by empty string if it contains only whitespaces // it helps avoid disallowTrailingWhitespace errors on last line if (!rHasNonWhitespace.test(lines[lines.length - 1])) { lines[lines.length - 1] = ''; } // calculate min line offset offset = Math.min.apply(null, lines.map(function(line) { // skip empty lines if (!line) { return Infinity; } // fetch whitespaces at the line beginning var offsetStr = line.match(/^\s*/)[0]; var tabCount = offsetStr.match(/\t*/)[0].length; if (offsetStr.length === line.length) { return 0; } // mixed spaces and tabs in one offset -> don't remove offsets if (tabCount && tabCount !== offsetStr.length) { return 0; } if (tabCount) { if (spaceOnlyOffset) { // no spaces, but previous offset has ony spaces -> mixed spaces and tabs return 0; } else { // remember offset contains only tabs tabOnlyOffset = true; } } else { if (tabOnlyOffset) { // no tabs, but previous offset has only tabs -> mixed spaces and tabs return 0; } else { // remember offset contains only spaces spaceOnlyOffset = true; } } return offsetStr.length; })); // remove common offsets if possible if (offset) { lines = lines.map(function(line) { return line.substr(offset); }); } return { source: lines.join('\n'), offset: offset, lineCount: lineCount }; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var htmlparser = require('htmlparser2');··· va{ lines.shift(); } |
| ✓ Negative was executed (else) | var h··· // replace last line by empty string if it contains only whitespaces |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var htmlparser = require('htmlparser2');··· var Errors = requ{ lines[lines.length - 1] = ''; } |
| ✓ Negative was executed (else) | var h··· // calculate min line offset |
| Function (anonymous_240) | |
|---|---|
| ✓ Was called | var htmlparser = require('htmlparser2');··· varfunction(line) { // skip empty lines if (!line) { return Infinity; } // fetch whitespaces at the line beginning var offsetStr = line.match(/^\s*/)[0]; var tabCount = offsetStr.match(/\t*/)[0].length; if (offsetStr.length === line.length) { return 0; } // mixed spaces and tabs in one offset -> don't remove offsets if (tabCount && tabCount !== offsetStr.length) { return 0; } if (tabCount) { if (spaceOnlyOffset) { // no spaces, but previous offset has ony spaces -> mixed spaces and tabs return 0; } else { // remember offset contains only tabs tabOnlyOffset = true; } } else { if (tabOnlyOffset) { // no tabs, but previous offset has only tabs -> mixed spaces and tabs return 0; } else { // remember offset contains only spaces spaceOnlyOffset = true; } } return offsetStr.length; })); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var htmlparser = re{··· return Infinity; } |
| ✓ Negative was executed (else) | var htmlp··· // fetch whitespaces at the line beginning |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var htmlparser = require('htmlparser2');··· var E{ return 0; } |
| ✓ Negative was executed (else) | var htmlp··· // mixed spaces and tabs in one offset -> don't remove offsets |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var htmlparser = require('htmlparser2');··· var Errors = r{ return 0; } |
| ✓ Negative was executed (else) | var htmlp··· if (tabCount) { |
| Branch LogicalExpression | |
| ✓ Was returned | var htmlparser = requiretabCount !== offsetStr.length) { |
| ✓ Was returned | var htmlparstabCount && tabCount !== offsetStr.length) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var htmlparser = requi{··· if (spaceOnlyOffset) { // no spaces, but previous offset has ony spaces -> mixed spaces and tabs return 0; } else { // remember offset contains only tabs tabOnlyOffset = true; } } else { |
| ✓ Negative was executed (else) | var htmlparser {··· if (tabOnlyOffset) { // no tabs, but previous offset has only tabs -> mixed spaces and tabs return 0; } else { // remember offset contains only spaces spaceOnlyOffset = true; } } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var htmlparser = require('htmlpar{··· // no spaces, but previous offset has ony spaces -> mixed spaces and tabs return 0; } else { |
| ✓ Negative was executed (else) | var htmlparser = re{··· // remember offset contains only tabs tabOnlyOffset = true; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var htmlparser = require('htmlp{··· // no tabs, but previous offset has only tabs -> mixed spaces and tabs return 0; } else { |
| ✓ Negative was executed (else) | var htmlparser = re{··· // remember offset contains only spaces spaceOnlyOffset = true; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var htmlparser ={··· lines = lines.map(function(line) { return line.substr(offset); }); } |
| ✓ Negative was executed (else) | var h··· return { |
| Function (anonymous_241) | |
|---|---|
| ✓ Was called | var htmlparser = require('function(line) {··· return line.substr(offset); }); |
| Function extractJs | |
|---|---|
| ✓ Was called | function extractJs(filename, data) {··· var errors = new Errors(new HtmlFile({ filename: filename, source: data })); var scripts = getScripts(data); var sources = []; var line = 1; var lastHtmlPos = 0; scripts.forEach(function(scriptInfo) { // fetch script source and normalize it var normalized = normalizeSource(scriptInfo.source); // add line offset before script line += data.substring(lastHtmlPos, scriptInfo.start).split(rLineSplit).length - 1; sources.push({ source: normalized.source, offset: normalized.offset, line: line }); // save offsets for next fragment line += normalized.lineCount - 1; lastHtmlPos = scriptInfo.end; }); return { sources: sources, errors: errors, addError: function(error) { errors._errorList.push({ filename: filename, rule: error.rule, message: error.message, line: error.line, column: error.column }); } }; } |
| Function (anonymous_243) | |
|---|---|
| ✓ Was called | var htmlparser = reqfunction(scriptInfo) {··· // fetch script source and normalize it var normalized = normalizeSource(scriptInfo.source); // add line offset before script line += data.substring(lastHtmlPos, scriptInfo.start).split(rLineSplit).length - 1; sources.push({ source: normalized.source, offset: normalized.offset, line: line }); // save offsets for next fragment line += normalized.lineCount - 1; lastHtmlPos = scriptInfo.end; }); |
| Function (anonymous_244) | |
|---|---|
| ✓ Was called | var htmlparser = rfunction(error) {··· errors._errorList.push({ filename: filename, rule: error.rule, message: error.message, line: error.line, column: error.column }); } |
| Function req | |
|---|---|
| ✓ Was called | function req(entity, dir) {··· return require( resolve.sync(entity, { basedir: dir }) ); } |
| Function NodeConfiguration | |
|---|---|
| ✓ Was called | function NodeConfiguration() {··· Configuration.call(this); this._basePath = process.cwd(); } |
| Function (anonymous_247) | |
|---|---|
| ✓ Was called | var path = require('path');··· var util = requirefunction(program) { var overrides = {}; OVERRIDE_OPTIONS.forEach(function(option) { if (option in program) { overrides[option] = program[option]; } }); this.override(overrides); }; |
| Function (anonymous_248) | |
|---|---|
| ✓ Was called | var path = require('path');··· vfunction(option) { if (option in program) { overrides[option] = program[option]; } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var path = require('path');··· var{ overrides[option] = program[option]; } |
| ✓ Negative was executed (else) | var path ··· }); |
| Function (anonymous_249) | |
|---|---|
| ✓ Was called | var path = require('path');··· var util = requfunction(external, type, config) { assert( typeof external === 'string' || external === null, '"' + type + '" option requires a string or null value' ); if (external === null) { return null; } var dir = config ? path.dirname(config) : this._basePath; var get = function(prefix, postfix) { prefix = prefix || ''; postfix = postfix || ''; try { return finder( utils.normalizePath(prefix + external + postfix, dir), dir ); } catch (e) {} return null; }.bind(this); var finder; if (type === 'preset') { finder = configFinder.getContent; } else { finder = req; } var content; if (external.indexOf('jscs-') !== 0) { content = get('jscs-'); if (!content && type === 'preset') { content = get('jscs-preset-') || get('jscs-config-'); if (!content && external.indexOf('/') !== -1 && !external.split('.')[1]) { content = get('jscs-', '.json') || get('jscs-', '.js') || get('jscs-preset-', '.json') || get('jscs-config-', '.json') || get('jscs-preset-', '.js') || get('jscs-config-', '.js'); } } } return content || get(); }; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var path = require('path');··· var util = rexternal === null, |
| ✓ Was returned | var pathtypeof external === 'string' || external === null, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var path = require('path');{··· return null; } |
| ✓ Negative was executed (else) | var p··· var dir = config ? path.dirname(config) : this._basePath; |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | var path = require('patpath.dirname(config) : this._basePath; |
| ✓ Negative was returned (: ...) | var path = require('path');··· var util = requirethis._basePath; |
| Function (anonymous_250) | |
|---|---|
| ✓ Was called | var path = reqfunction(prefix, postfix) {··· prefix = prefix || ''; postfix = postfix || ''; try { return finder( utils.normalizePath(prefix + external + postfix, dir), dir ); } catch (e) {} return null; }.bind(this); |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var path = require('path');''; |
| ✓ Was returned | var path = requirprefix || ''; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var path = require('path');··· v''; |
| ✓ Was returned | var path = requirepostfix || ''; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var path = require('path');{··· finder = configFinder.getContent; } else { |
| ✓ Negative was executed (else) | var path = {··· finder = req; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var path = require('path');··· var util = re{ content = get('jscs-'); if (!content && type === 'preset') { content = get('jscs-preset-') || get('jscs-config-'); if (!content && external.indexOf('/') !== -1 && !external.split('.')[1]) { content = get('jscs-', '.json') || get('jscs-', '.js') || get('jscs-preset-', '.json') || get('jscs-config-', '.json') || get('jscs-preset-', '.js') || get('jscs-config-', '.js'); } } } |
| ✓ Negative was executed (else) | var p··· return content || get(); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var path = require('path');··· var util = requ{ content = get('jscs-preset-') || get('jscs-config-'); if (!content && external.indexOf('/') !== -1 && !external.split('.')[1]) { content = get('jscs-', '.json') || get('jscs-', '.js') || get('jscs-preset-', '.json') || get('jscs-config-', '.json') || get('jscs-preset-', '.js') || get('jscs-config-', '.js'); } } |
| ✓ Negative was executed (else) | var path ··· } |
| Branch LogicalExpression | |
| ✓ Was returned | var path = require('pathtype === 'preset') { |
| ✓ Was returned | var path = r!content && type === 'preset') { |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var path = require('path');··· var util = requirget('jscs-config-'); |
| ✓ Was returned | var path = require('paget('jscs-preset-') || get('jscs-config-'); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var path = require('path');··· var util = require('util'); var fs = require('fs'); var a{ content = get('jscs-', '.json') || get('jscs-', '.js') || get('jscs-preset-', '.json') || get('jscs-config-', '.json') || get('jscs-preset-', '.js') || get('jscs-config-', '.js'); } |
| ✓ Negative was executed (else) | var path = re··· } |
| Branch LogicalExpression | |
| ✓ Was returned | var path = require('path');··· var util = require('util'); var !external.split('.')[1]) { |
| ✓ Was returned | var path = requi!content && external.indexOf('/') !== -1 && !external.split('.')[1]) { |
| Branch LogicalExpression | |
| ✓ Was returned | var path = require('path');··· external.indexOf('/') !== -1 && !external.split('.')[1]) { |
| ✓ Was returned | var path = requi!content && external.indexOf('/') !== -1 && !external.split('.')[1]) { |
| Branch LogicalExpression | |
|---|---|
| ✗ Was not returned | var path = require('get('jscs-config-', '.js'); |
| ✓ Was returned | var path = require('path')get('jscs-', '.json') ||··· get('jscs-', '.js') || get('jscs-preset-', '.json') || get('jscs-config-', '.json') || get('jscs-preset-', '.js') || |
| Branch LogicalExpression | |
| ✗ Was not returned | var path = require('get('jscs-preset-', '.js') || |
| ✓ Was returned | var path = require('path')get('jscs-', '.json') ||··· get('jscs-', '.js') || get('jscs-preset-', '.json') || get('jscs-config-', '.json') || |
| Branch LogicalExpression | |
| ✗ Was not returned | var path = require('get('jscs-config-', '.json') || |
| ✓ Was returned | var path = require('path')get('jscs-', '.json') ||··· get('jscs-', '.js') || get('jscs-preset-', '.json') || |
| Branch LogicalExpression | |
| ✓ Was returned | var path = require('get('jscs-preset-', '.json') || |
| ✓ Was returned | var path = require('path')get('jscs-', '.json') ||··· get('jscs-', '.js') || |
| Branch LogicalExpression | |
| ✓ Was returned | var path = require('get('jscs-', '.js') || |
| ✓ Was returned | var path = require('path')get('jscs-', '.json') || |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var path = require('paget(); |
| ✓ Was returned | var path = content || get(); |
| Function (anonymous_251) | |
|---|---|
| ✓ Was called | var path = require('path');··· var util = reqfunction(plugin, config) { if (typeof plugin !== 'function') { plugin = this.loadExternal(plugin, 'plugin', config); } return Configuration.prototype._loadPlugin.call(this, plugin); }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var path = require('path');··· var util ={ plugin = this.loadExternal(plugin, 'plugin', config); } |
| ✓ Negative was executed (else) | var p··· return Configuration.prototype._loadPlugin.call(this, plugin); |
| Function (anonymous_252) | |
|---|---|
| ✓ Was called | var path = require('path');··· var util = reqfunction(preset, config) { var name = path.basename(preset).split('.')[0]; try { this.registerPreset(name, this.loadExternal(preset, 'preset', config)); } catch (e) { var registeredPresets = this.getRegisteredPresets(); if (preset in registeredPresets) { Configuration.prototype._loadPreset.call(this, preset); return; } } // If preset is an external module, error will be thrown by the caller Configuration.prototype._loadPreset.call(this, name); }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var path = require('path');··· var util = re{ Configuration.prototype._loadPreset.call(this, preset); return; } |
| ✓ Negative was executed (else) | var path ··· } |
| Function (anonymous_253) | |
|---|---|
| ✓ Was called | var path = require('path');··· var util = require(function(filter, config) { Configuration.prototype._loadErrorFilter.call( this, this.loadExternal(filter, 'errorFilter', config) ); }; |
| Function (anonymous_254) | |
|---|---|
| ✓ Was called | var path = require('path');··· var util = requfunction(esprima, config) { Configuration.prototype._loadEsprima.call( this, this.loadExternal(esprima, 'esprima', config) ); }; |
| Function (anonymous_255) | |
|---|---|
| ✓ Was called | var path = require('path');··· var util = require('utfunction(additionalRule, config) { config = config || this._basePath; if (typeof additionalRule === 'string') { if (glob.hasMagic(additionalRule)) { // In some cases there might not be a config // like if options are defined through direct initialization (grunt plugin case) config = fs.statSync(config).isDirectory() ? config : path.dirname(config); glob.sync(path.resolve(config, additionalRule)).forEach(function(p) { var Rule = require(p); Configuration.prototype._loadAdditionalRule.call(this, new Rule()); }, this); } else { var Rule = this.loadExternal(additionalRule, 'rule', config); Configuration.prototype._loadAdditionalRule.call(this, new Rule()); } } else { Configuration.prototype._loadAdditionalRule.call(this, additionalRule); } }; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var path = require('patthis._basePath; |
| ✓ Was returned | var path = reconfig || this._basePath; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var path = require('path');··· var util = requi{ if (glob.hasMagic(additionalRule)) { // In some cases there might not be a config // like if options are defined through direct initialization (grunt plugin case) config = fs.statSync(config).isDirectory() ? config : path.dirname(config); glob.sync(path.resolve(config, additionalRule)).forEach(function(p) { var Rule = require(p); Configuration.prototype._loadAdditionalRule.call(this, new Rule()); }, this); } else { var Rule = this.loadExternal(additionalRule, 'rule', config); Configuration.prototype._loadAdditionalRule.call(this, new Rule()); } } else { |
| ✓ Negative was executed (else) | var path = {··· Configuration.prototype._loadAdditionalRule.call(this, additionalRule); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var path = require('path');··· var util = requ{ // In some cases there might not be a config // like if options are defined through direct initialization (grunt plugin case) config = fs.statSync(config).isDirectory() ? config : path.dirname(config); glob.sync(path.resolve(config, additionalRule)).forEach(function(p) { var Rule = require(p); Configuration.prototype._loadAdditionalRule.call(this, new Rule()); }, this); } else { |
| ✓ Negative was executed (else) | var path = requ{··· var Rule = this.loadExternal(additionalRule, 'rule', config); Configuration.prototype._loadAdditionalRule.call(this, new Rule()); } |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | var path = require('path');··· var util = require('util'); vconfig : path.dirname(config); |
| ✓ Negative was returned (: ...) | var path = require('path');··· var util = require('util'); var fs = rpath.dirname(config); |
| Function (anonymous_256) | |
|---|---|
| ✓ Was called | var path = require('path');··· var util = require('util'); var fs = reqfunction(p) { var Rule = require(p); Configuration.prototype._loadAdditionalRule.call(this, new Rule()); }, this); |
| Function (anonymous_257) | |
|---|---|
| ✓ Was called | var path = require('path');··· var function(name, dialect) { dialect = dialect || 'es5'; var identifierRegex = dialect === 'es5' ? IDENTIFIER_NAME_ES5_RE : IDENTIFIER_NAME_ES6_RE; return !reservedWords.check(name, dialect, true) && identifierRegex.test(name); }; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var path = require('path''es5'; |
| ✓ Was returned | var path = reqdialect || 'es5'; |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | var path = require('path');··· var Vow = require(IDENTIFIER_NAME_ES5_RE : IDENTIFIER_NAME_ES6_RE; |
| ✓ Negative was returned (: ...) | var path = require('path');··· var Vow = require('vow'); var reservedWordsIDENTIFIER_NAME_ES6_RE; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var path = require('path');··· var Vow = require('vow'); vaidentifierRegex.test(name); |
| ✓ Was returned | var path = !reservedWords.check(name, dialect, true) && identifierRegex.test(name); |
| Function (anonymous_258) | |
|---|---|
| ✓ Was called | var path = require('patfunction(name) {··· return SNAKE_CASE_RE.test(name); }; |
| Function (anonymous_259) | |
|---|---|
| ✓ Was called | var path = require('path');··· var Vofunction(node) { if (node.type !== 'CallExpression') { return null; } var callee = node.callee; if (callee.type === 'FunctionExpression') { return callee; } if (callee.type === 'MemberExpression' && callee.object.type === 'FunctionExpression' && callee.property.type === 'Identifier' && (callee.property.name === 'call' || callee.property.name === 'apply') ) { return callee.object; } return null; }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var path = require('path');··· var Vow = re{ return null; } |
| ✓ Negative was executed (else) | var p··· var callee = node.callee; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var path = require('path');··· var Vow = require({ return callee; } |
| ✓ Negative was executed (else) | var p··· if (callee.type === 'MemberExpression' && |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var pa{··· return callee.object; } |
| ✓ Negative was executed (else) | var p··· return null; |
| Branch LogicalExpression | |
| ✓ Was returned | var path callee.property.name === 'call' || callee.property.name === 'apply') |
| ✓ Was returned | var pathcallee.type === 'MemberExpression' &&··· callee.object.type === 'FunctionExpression' && callee.property.type === 'Identifier' && |
| Branch LogicalExpression | |
| ✓ Was returned | var pathcallee.property.type === 'Identifier' && |
| ✓ Was returned | var pathcallee.type === 'MemberExpression' &&··· callee.object.type === 'FunctionExpression' && |
| Branch LogicalExpression | |
| ✓ Was returned | var pathcallee.object.type === 'FunctionExpression' && |
| ✓ Was returned | var pathcallee.type === 'MemberExpression' && |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var path = require('path');··· var Vow = requircallee.property.name === 'apply') |
| ✓ Was returned | var path callee.property.name === 'call' || callee.property.name === 'apply') |
| Function (anonymous_260) | |
|---|---|
| ✓ Was called | var path = require('path')function(name) {··· var res = name.replace(TRAILING_UNDERSCORES_RE, ''); return res ? res : name; }; |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | var path = requirres : name; |
| ✓ Negative was returned (: ...) | var path = require('patname; |
| Function (anonymous_261) | |
|---|---|
| ✓ Was called | var path = require('path'function(path) {··· // Logic from: https://github.com/joyent/node/blob/4f1ae11a62b97052bc83756f8cb8700cc1f61661/lib/module.js#L237 var start = path.substring(0, 2); return start === './' || start === '..'; }; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var path = require('path');··· vstart === '..'; |
| ✓ Was returned | var path = start === './' || start === '..'; |
| Function (anonymous_262) | |
|---|---|
| ✓ Was called | var path = require('pathfunction(filepath, basePath) {··· if (this.isRelativePath(filepath)) { return path.resolve(basePath, filepath); } return filepath; }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var path = require('path');··· var Vow = r{ return path.resolve(basePath, filepath); } |
| ✓ Negative was executed (else) | var p··· return filepath; |
| Function (anonymous_263) | |
|---|---|
| ✓ Was called | var path = require('function(fn) {··· return function() { var deferred = Vow.defer(); var args = [].slice.call(arguments); args.push(function(err, result) { if (err) { deferred.reject(err); } else { deferred.resolve(result); } }); fn.apply(null, args); return deferred.promise(); }; }; |
| Function (anonymous_264) | |
|---|---|
| ✓ Was called | var path = function() {··· var deferred = Vow.defer(); var args = [].slice.call(arguments); args.push(function(err, result) { if (err) { deferred.reject(err); } else { deferred.resolve(result); } }); fn.apply(null, args); return deferred.promise(); }; |
| Function (anonymous_265) | |
|---|---|
| ✓ Was called | var path = requirefunction(err, result) {··· if (err) { deferred.reject(err); } else { deferred.resolve(result); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var path = require('p{··· deferred.reject(err); } else { |
| ✓ Negative was executed (else) | var path = require({··· deferred.resolve(result); } |
| Function (anonymous_266) | |
|---|---|
| ✓ Was called | var path = require(function(additionalExceptions) {··· var pragmaKeywords = [ 'eslint', 'eslint-env', 'eslint-enable', 'eslint-disable', 'eslint-disable-line', 'global', 'jshint', 'jslint', 'globals', 'falls through', 'exported', 'jscs:', 'jscs:enable', 'jscs:disable', 'jscs:ignore', 'istanbul' ]; if (additionalExceptions && Array.isArray(additionalExceptions)) { pragmaKeywords = pragmaKeywords.concat(additionalExceptions); } return function(comment) { // pragmaKeywords precede a space or the end of the comment var trimmedComment = comment.trim() + ' '; for (var i = 0; i < pragmaKeywords.length; i++) { if (trimmedComment.indexOf(pragmaKeywords[i] + ' ') === 0) { return true; } } return false; }; }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var path = require('path');··· var Vow = require('vow'); var reservedWor{ pragmaKeywords = pragmaKeywords.concat(additionalExceptions); } |
| ✓ Negative was executed (else) | var p··· return function(comment) { |
| Branch LogicalExpression | |
| ✓ Was returned | var path = require('path');··· var Array.isArray(additionalExceptions)) { |
| ✓ Was returned | var pathadditionalExceptions && Array.isArray(additionalExceptions)) { |
| Function (anonymous_267) | |
|---|---|
| ✓ Was called | var path = function(comment) {··· // pragmaKeywords precede a space or the end of the comment var trimmedComment = comment.trim() + ' '; for (var i = 0; i < pragmaKeywords.length; i++) { if (trimmedComment.indexOf(pragmaKeywords[i] + ' ') === 0) { return true; } } return false; }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var path = require('path');··· var Vow = require('vow'); var reservedWords{ return true; } |
| ✓ Negative was executed (else) | var path = re··· } |
| Function cli | |
|---|---|
| ✓ Was called | /**··· * Command lifunction cli(program) { var reporter; var config; var checkerPromise; var defer = Vow.defer(); var promise = defer.promise(); var checker = new Checker(); var args = program.args; var returnArgs = { checker: checker, reporter: program.reporter, promise: promise }; function handleMaxErrors() { if (checker.maxErrorsExceeded()) { console.error('Too many errors... Increase `maxErrors` configuration option value to see more.'); } } promise.always(function(status) { exit(status.valueOf()); }); try { config = configFile.load(program.config); } catch (e) { console.error('Config source is corrupted -', e.toString()); defer.reject(5); return returnArgs; } /** * Trying to load config. * Custom config path can be specified using '-c' option. */ if (!config && !program.preset && !program.autoConfigure) { if (program.config) { console.error('Configuration source', program.config, 'was not found.'); } else { console.error('No configuration found. Add a .jscsrc file to your project root or use the -c option.'); } defer.reject(4); return returnArgs; } if (!args.length && process.stdin.isTTY && typeof program.autoConfigure !== 'string') { console.error('No input files specified. Try option --help for usage information.'); defer.reject(3); return returnArgs; } reporter = configFile.getReporter(program.reporter, program.colors); returnArgs.reporter = reporter.path; if (!reporter.writer) { console.error('Reporter "%s" does not exist.', program.reporter); returnArgs.reporter = reporter.path; defer.reject(6); return returnArgs; } if (!config) { config = {}; } // To run autoconfigure over all errors in the path if (program.autoConfigure) { program.maxErrors = Infinity; } checker.getConfiguration().overrideFromCLI(program); checker.getConfiguration().registerDefaultRules(); try { checker.configure(config); } catch (e) { console.error(e.message); defer.reject(1); return returnArgs; } if (program.autoConfigure) { var generator = new ConfigGenerator(); generator .generate(program.autoConfigure) .then(function() { defer.resolve(0); }, function(error) { console.error('Configuration generation failed due to ', error); defer.reject(7); }); return returnArgs; } // Handle usage like 'cat myfile.js | jscs' or 'jscs -'' var usedDash = args[args.length - 1] === '-'; if (!args.length || usedDash) { // So the dash doesn't register as a file if (usedDash) { args.length--; } if (program.fix) { return { promise: checker.fixStdin().then(function(result) { process.stdout.write(result.output); }), checker: checker }; } checkerPromise = checker.checkStdin().then(function(errors) { return [errors]; }); } // Processing specified files and dirs. if (args.length) { checkerPromise = Vow.all(args.map(checker.execute, checker)).then(function(results) { return [].concat.apply([], results); }); } checkerPromise.then(function(errorsCollection) { reporter.writer(errorsCollection); handleMaxErrors(); errorsCollection.forEach(function(errors) { if (!errors.isEmpty()) { defer.reject(2); } }); defer.resolve(0); }).fail(function(e) { console.error(e.stack); defer.reject(1); }); return returnArgs; }; |
| Function handleMaxErrors | |
|---|---|
| ✓ Was called | /**··· function handleMaxErrors() { if (checker.maxErrorsExceeded()) { console.error('Too many errors... Increase `maxErrors` configuration option value to see more.'); } } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Command line implementation for JS{ console.error('Too many errors... Increase `maxErrors` configuration option value to see more.'); } |
| ✓ Negative was executed (else) | /**··· * Co } |
| Function (anonymous_270) | |
|---|---|
| ✓ Was called | /**··· * Command linefunction(status) { exit(status.valueOf()); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Command line implementation for JSCS. * * See documen{ if (program.config) { console.error('Configuration source', program.config, 'was not found.'); } else { console.error('No configuration found. Add a .jscsrc file to your project root or use the -c option.'); } defer.reject(4); return returnArgs; } |
| ✓ Negative was executed (else) | /**··· if (!args.length && process.stdin.isTTY && typeof program.autoConfigure !== 'string') { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Command line implementation for!program.autoConfigure) { |
| ✓ Was returned | /**··· * C!config && !program.preset && !program.autoConfigure) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Command line!program.preset && !program.autoConfigure) { |
| ✓ Was returned | /**··· * C!config && !program.preset && !program.autoConfigure) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Command line implemen{ console.error('Configuration source', program.config, 'was not found.'); } else { |
| ✓ Negative was executed (else) | /**··· * Command { console.error('No configuration found. Add a .jscsrc file to your project root or use the -c option.'); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Command line implementation for JSCS. * * See documentation on exit codes in - ht{ console.error('No input files specified. Try option --help for usage information.'); defer.reject(3); return returnArgs; } |
| ✓ Negative was executed (else) | /**··· reporter = configFile.getReporter(program.reporter, program.colors); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Command line implementation for JSCS. *typeof program.autoConfigure !== 'string') { |
| ✓ Was returned | /**··· * C!args.length && process.stdin.isTTY && typeof program.autoConfigure !== 'string') { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Command line implprocess.stdin.isTTY && typeof program.autoConfigure !== 'string') { |
| ✓ Was returned | /**··· * C!args.length && process.stdin.isTTY && typeof program.autoConfigure !== 'string') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Command line implem{ console.error('Reporter "%s" does not exist.', program.reporter); returnArgs.reporter = reporter.path; defer.reject(6); return returnArgs; } |
| ✓ Negative was executed (else) | /**··· if (!config) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Command li{ config = {}; } |
| ✓ Negative was executed (else) | /**··· // To run autoconfigure over all errors in the path |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Command line implementat{ program.maxErrors = Infinity; } |
| ✓ Negative was executed (else) | /**··· checker.getConfiguration().overrideFromCLI(program); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Command line implementat{ var generator = new ConfigGenerator(); generator .generate(program.autoConfigure) .then(function() { defer.resolve(0); }, function(error) { console.error('Configuration generation failed due to ', error); defer.reject(7); }); return returnArgs; } |
| ✓ Negative was executed (else) | /**··· // Handle usage like 'cat myfile.js | jscs' or 'jscs -'' |
| Function (anonymous_271) | |
|---|---|
| ✓ Was called | /**··· * Commandfunction() { defer.resolve(0); }, function(error) { |
| Function (anonymous_272) | |
|---|---|
| ✓ Was called | /**··· * Commfunction(error) { console.error('Configuration generation failed due to ', error); defer.reject(7); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Command line implementation{ // So the dash doesn't register as a file if (usedDash) { args.length--; } if (program.fix) { return { promise: checker.fixStdin().then(function(result) { process.stdout.write(result.output); }), checker: checker }; } checkerPromise = checker.checkStdin().then(function(errors) { return [errors]; }); } |
| ✓ Negative was executed (else) | /**··· // Processing specified files and dirs. |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Command line implusedDash) { |
| ✓ Was returned | /**··· * C!args.length || usedDash) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Command line im{ args.length--; } |
| ✓ Negative was executed (else) | /**··· * Command line implementation for J if (program.fix) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Command line imple{ return { promise: checker.fixStdin().then(function(result) { process.stdout.write(result.output); }), checker: checker }; } |
| ✓ Negative was executed (else) | /**··· * Co checkerPromise = checker.checkStdin().then(function(errors) { |
| Function (anonymous_273) | |
|---|---|
| ✓ Was called | /**··· * Command line implementation for JSCS. * function(result) { process.stdout.write(result.output); }), |
| Function (anonymous_274) | |
|---|---|
| ✓ Was called | /**··· * Command line implementation for JSCS. * * function(errors) { return [errors]; }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Command line i{ checkerPromise = Vow.all(args.map(checker.execute, checker)).then(function(results) { return [].concat.apply([], results); }); } |
| ✓ Negative was executed (else) | /**··· checkerPromise.then(function(errorsCollection) { |
| Function (anonymous_275) | |
|---|---|
| ✓ Was called | /**··· * Command line implementation for JSCS. * * See documentation on exfunction(results) { return [].concat.apply([], results); }); |
| Function (anonymous_276) | |
|---|---|
| ✓ Was called | /**··· * Command line implfunction(errorsCollection) { reporter.writer(errorsCollection); handleMaxErrors(); errorsCollection.forEach(function(errors) { if (!errors.isEmpty()) { defer.reject(2); } }); defer.resolve(0); }).fail(function(e) { |
| Function (anonymous_277) | |
|---|---|
| ✓ Was called | /**··· * Command line implementatiofunction(errors) { if (!errors.isEmpty()) { defer.reject(2); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Command line implementation { defer.reject(2); } |
| ✓ Negative was executed (else) | /**··· * Comman }); |
| Function (anonymous_278) | |
|---|---|
| ✓ Was called | /**··· * Commafunction(e) { console.error(e.stack); defer.reject(1); }); |
| Function Generator | |
|---|---|
| ✓ Was called | function Generator() {··· this._config = {}; } |
| Function (anonymous_280) | |
|---|---|
| ✓ Was called | var fs = require('fs');··· var Vofunction(path) { var checker = getChecker(); var _path = utils.normalizePath(path, checker.getConfiguration().getBasePath()); var presetNames = Object.keys(checker.getConfiguration().getRegisteredPresets()); var statsForPresets; console.log('Checking', _path, 'against the presets'); return Vow .all(presetNames.map(this._checkAgainstPreset.bind(this, _path))) .then(function(resultsPerPreset) { statsForPresets = this._generateStatsForPresets(resultsPerPreset, presetNames); return statsForPresets; }.bind(this)) .then(this._showErrorCounts.bind(this)) .then(this._getUserPresetChoice.bind(this, prompts[0])) .then(function showViolatedRules(choiceObj) { var presetIndex = choiceObj[prompts[0].name] - 1; var presetName = statsForPresets[presetIndex].name; console.log('You chose the ' + presetName + ' preset'); this._config.preset = presetName; var errorStats = getErrorsByRuleName(statsForPresets[presetIndex].errors); var violatedRuleCount = Object.keys(errorStats).length; if (!violatedRuleCount) { return this._config; } console.log(_path + ' violates ' + violatedRuleCount + ' rule' + (violatedRuleCount > 1 ? 's' : '')); var errorPrompts = generateRuleHandlingPrompts(errorStats); return this._getUserViolationChoices(errorPrompts) .then(this._handleViolatedRules.bind(this, errorPrompts)) .then(function() { return this._config; }.bind(this)); }.bind(this)) .then(function flushConfig() { fs.writeFileSync(process.cwd() + '/.jscsrc', JSON.stringify(this._config, null, '\t')); console.log('Generated a .jscsrc configuration file in ' + process.cwd()); }.bind(this)); }; |
| Function (anonymous_281) | |
|---|---|
| ✓ Was called | var fs = rfunction(resultsPerPreset) {··· statsForPresets = this._generateStatsForPresets(resultsPerPreset, presetNames); return statsForPresets; }.bind(this)) |
| Function showViolatedRules | |
|---|---|
| ✓ Was called | var fs = rfunction showViolatedRules(choiceObj) {··· var presetIndex = choiceObj[prompts[0].name] - 1; var presetName = statsForPresets[presetIndex].name; console.log('You chose the ' + presetName + ' preset'); this._config.preset = presetName; var errorStats = getErrorsByRuleName(statsForPresets[presetIndex].errors); var violatedRuleCount = Object.keys(errorStats).length; if (!violatedRuleCount) { return this._config; } console.log(_path + ' violates ' + violatedRuleCount + ' rule' + (violatedRuleCount > 1 ? 's' : '')); var errorPrompts = generateRuleHandlingPrompts(errorStats); return this._getUserViolationChoices(errorPrompts) .then(this._handleViolatedRules.bind(this, errorPrompts)) .then(function() { return this._config; }.bind(this)); }.bind(this)) |
| Branch IfStatement | |
|---|---|
| ✗ Positive was not executed (if) | var fs = require('fs');··· var Vow{ return this._config; } |
| ✓ Negative was executed (else) | var fs = require('fs');··· var Vow = require('vow'); var T console.log(_path + ' violates ' + violatedRuleCount + ' rule' + (violatedRuleCount > 1 ? 's' : '')); |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | var fs = require('fs');··· var Vow = require('vow'); var Table = require('cli-table'); var prompt = 's' : '')); |
| ✗ Negative was not returned (: ...) | var fs = require('fs');··· var Vow = require('vow'); var Table = require('cli-table'); var prompt = requir'')); |
| Function (anonymous_283) | |
|---|---|
| ✗ Was not called | var fs = requifunction() {··· return this._config; }.bind(this)); |
| Function flushConfig | |
|---|---|
| ✗ Was not called | var fs = rfunction flushConfig() {··· fs.writeFileSync(process.cwd() + '/.jscsrc', JSON.stringify(this._config, null, '\t')); console.log('Generated a .jscsrc configuration file in ' + process.cwd()); }.bind(this)); |
| Function (anonymous_285) | |
|---|---|
| ✓ Was called | var fs = require('fs');··· var Vow = require('vowfunction(resultsPerPreset, presetNames) { return resultsPerPreset.map(function(presetResults, idx) { var errorCollection = [].concat.apply([], presetResults); var presetStats = { name: presetNames[idx], sum: 0, errors: [] }; errorCollection.forEach(function(error) { presetStats.sum += error.getErrorCount(); presetStats.errors = presetStats.errors.concat(error.getErrorList()); }); return presetStats; }); }; |
| Function (anonymous_286) | |
|---|---|
| ✓ Was called | var fs = require('fs');··· var Vowfunction(presetResults, idx) { var errorCollection = [].concat.apply([], presetResults); var presetStats = { name: presetNames[idx], sum: 0, errors: [] }; errorCollection.forEach(function(error) { presetStats.sum += error.getErrorCount(); presetStats.errors = presetStats.errors.concat(error.getErrorList()); }); return presetStats; }); |
| Function (anonymous_287) | |
|---|---|
| ✓ Was called | var fs = require('fs');··· var Vowfunction(error) { presetStats.sum += error.getErrorCount(); presetStats.errors = presetStats.errors.concat(error.getErrorList()); }); |
| Function (anonymous_288) | |
|---|---|
| ✓ Was called | var fs = require('fs');··· var Vow = requfunction(statsForPresets) { var table = getTable(); statsForPresets.forEach(function(presetStats, idx) { table.push([idx + 1, presetStats.name, presetStats.sum, getUniqueErrorNames(presetStats.errors).length]); }); console.log(table.toString()); }; |
| Function (anonymous_289) | |
|---|---|
| ✓ Was called | var fs = require('fs');··· varfunction(presetStats, idx) { table.push([idx + 1, presetStats.name, presetStats.sum, getUniqueErrorNames(presetStats.errors).length]); }); |
| Function (anonymous_290) | |
|---|---|
| ✓ Was called | var fs = require('fs');··· var Vow = require(function(prompt) { return this._showPrompt(prompt); }; |
| Function (anonymous_291) | |
|---|---|
| ✓ Was called | var fs = require('fs');··· var Vow = require('vowfunction(errorPrompts) { return this._showPrompt(errorPrompts); }; |
| Function (anonymous_292) | |
|---|---|
| ✗ Was not called | var fs = require('fs');··· var Vow = require(function(errorPrompts, choices) { errorPrompts.forEach(function(errorPrompt) { var userChoice = choices[errorPrompt.name]; if (userChoice.toLowerCase() === 'e') { this._config[errorPrompt.associatedRuleName] = null; } }, this); }; |
| Function (anonymous_293) | |
|---|---|
| ✗ Was not called | var fs = require('fs');··· function(errorPrompt) { var userChoice = choices[errorPrompt.name]; if (userChoice.toLowerCase() === 'e') { this._config[errorPrompt.associatedRuleName] = null; } }, this); |
| Branch IfStatement | |
|---|---|
| ✗ Positive was not executed (if) | var fs = require('fs');··· var Vow = require('vo{ this._config[errorPrompt.associatedRuleName] = null; } |
| ✗ Negative was not executed (else) | var fs = ··· }, this); |
| Function (anonymous_294) | |
|---|---|
| ✓ Was called | var fs = require('fs');··· var Vow = requirefunction(path, presetName) { var checker = getChecker(); checker.configure({preset: presetName, maxErrors: Infinity}); return checker.checkPath(path); }; |
| Function getChecker | |
|---|---|
| ✓ Was called | function getChecker() {··· var checker = new Checker(); checker.registerDefaultRules(); return checker; } |
| Function generateRuleHandlingPrompts | |
|---|---|
| ✓ Was called | function generateRuleHandlingPrompts(errors) {··· // Generate list of rule names, sorted by violation count (descending) var violatedRuleNames = Object.keys(errors); violatedRuleNames.sort(function(a, b) { return errors[b].violations - errors[a].violations; }); return violatedRuleNames.map(function(ruleName) { var violationCount = errors[ruleName].violations; var fileCount = Object.keys(errors[ruleName].files).length; var prompt = assign({}, prompts[1]); prompt.associatedRuleName = ruleName; prompt.name = chalk.green(ruleName) + ' (' + violationCount + ' violation' + (violationCount > 1 ? 's' : '') + ' in ' + fileCount + ' file' + (fileCount > 1 ? 's' : '') + '):\n ' + prompt.name; return prompt; }); } |
| Function (anonymous_297) | |
|---|---|
| ✓ Was called | var fs = require('fs');··· vafunction(a, b) { return errors[b].violations - errors[a].violations; }); |
| Function (anonymous_298) | |
|---|---|
| ✓ Was called | var fs = require('fs');··· var Vow function(ruleName) { var violationCount = errors[ruleName].violations; var fileCount = Object.keys(errors[ruleName].files).length; var prompt = assign({}, prompts[1]); prompt.associatedRuleName = ruleName; prompt.name = chalk.green(ruleName) + ' (' + violationCount + ' violation' + (violationCount > 1 ? 's' : '') + ' in ' + fileCount + ' file' + (fileCount > 1 ? 's' : '') + '):\n ' + prompt.name; return prompt; }); |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | var fs = require('fs');··· var Vow = require('vow'); var Table = require('c's' : '') + |
| ✓ Negative was returned (: ...) | var fs = require('fs');··· var Vow = require('vow'); var Table = require('cli-tab'') + |
| Branch ConditionalExpression | |
|---|---|
| ✗ Positive was not returned (? ...) | var fs = require('fs');··· var Vow = require('vow'); var Table's' : '') + '):\n ' + |
| ✓ Negative was returned (: ...) | var fs = require('fs');··· var Vow = require('vow'); var Table = req'') + '):\n ' + |
| Function getErrorsByRuleName | |
|---|---|
| ✓ Was called | function getErrorsByRuleName(errorsList) {··· var errors = {}; errorsList.forEach(function(error) { var rulename = error.rule; errors[rulename] = errors[rulename] || { files: {}, violations: 0 }; errors[rulename].violations += 1; errors[rulename].files[error.filename] = true; }); return errors; } |
| Function (anonymous_300) | |
|---|---|
| ✓ Was called | var fs = require('fs');function(error) {··· var rulename = error.rule; errors[rulename] = errors[rulename] || { files: {}, violations: 0 }; errors[rulename].violations += 1; errors[rulename].files[error.filename] = true; }); |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var fs = require('fs');··· var Vow = require('vow{ files: {}, violations: 0 }; |
| ✓ Was returned | var fs = require('fs');··· vaerrors[rulename] || { |
| Function getUniqueErrorNames | |
|---|---|
| ✓ Was called | function getUniqueErrorNames(errorsList) {··· var errorNameLUT = {}; errorsList.forEach(function(error) { errorNameLUT[error.rule] = true; }); return Object.keys(errorNameLUT); } |
| Function (anonymous_302) | |
|---|---|
| ✓ Was called | var fs = require('fs');function(error) {··· errorNameLUT[error.rule] = true; }); |
| Function getTable | |
|---|---|
| ✓ Was called | function getTable() {··· return new Table({ chars: { top: '', 'top-mid': '', 'top-left': '', 'top-right': '', bottom: '', 'bottom-mid': '', 'bottom-left': '', 'bottom-right': '', left: '', 'left-mid': '', mid: '', 'mid-mid': '', right: '', 'right-mid': '' , middle: ' ' }, style: { 'padding-left': 0, 'padding-right': 0 }, head: ['', 'Preset', '#Errors', '#Rules'] }); } |
| Function (anonymous_304) | |
|---|---|
| ✓ Was called | /**··· * Requires tfunction() {}; |
| Function (anonymous_305) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_306) | |
|---|---|
| ✓ Was called | /**··· * Requires thafunction() { return 'disallowAnonymousFunctions'; }, |
| Function (anonymous_307) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { file.iterateNodesByType(['FunctionExpression', 'FunctionDeclaration'], function(node) { if (node.id === null) { errors.add('Anonymous functions need to be named', node.loc.start); } }); } |
| Function (anonymous_308) | |
|---|---|
| ✓ Was called | /**··· * Requires that a function expression be named. * Named functions providefunction(node) { if (node.id === null) { errors.add('Anonymous functions need to be named', node.loc.start); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires that a function ex{ errors.add('Anonymous functions need to be named', node.loc.start); } |
| ✓ Negative was executed (else) | /**··· * Requir }); |
| Function (anonymous_309) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_310) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(options) { assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_311) | |
|---|---|
| ✓ Was called | /**··· * Disallows arfunction() { return 'disallowArrowFunctions'; }, |
| Function (anonymous_312) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { file.iterateNodesByType(['ArrowFunctionExpression'], function(node) { errors.add('Do not use arrow functions', node.loc.start); }); } |
| Function (anonymous_313) | |
|---|---|
| ✓ Was called | /**··· * Disallows arrow functions. * * Why enable this rule?function(node) { errors.add('Do not use arrow functions', node.loc.start); }); |
| Function (anonymous_314) | |
|---|---|
| ✓ Was called | /**··· * Requires tfunction() {}; |
| Function (anonymous_315) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_316) | |
|---|---|
| ✓ Was called | /**··· * Requires thefunction() { return 'disallowCapitalizedComments'; }, |
| Function (anonymous_317) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var letterPattern = require('../../patterns/L'); var lowerCasePattern = require('../../patterns/Ll'); file.iterateTokensByType(['Line', 'Block'], function(comment) { var stripped = comment.value.replace(/[\n\s\*]/g, ''); var firstChar = stripped[0]; if (letterPattern.test(firstChar) && !lowerCasePattern.test(firstChar)) { errors.add( 'Comments must start with a lowercase letter', comment.loc.start ); } }); } |
| Function (anonymous_318) | |
|---|---|
| ✓ Was called | /**··· * Requires the first alphabetical character of function(comment) { var stripped = comment.value.replace(/[\n\s\*]/g, ''); var firstChar = stripped[0]; if (letterPattern.test(firstChar) && !lowerCasePattern.test(firstChar)) { errors.add( 'Comments must start with a lowercase letter', comment.loc.start ); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires the first alphabetical character of a comment to be lowercase. * *{ errors.add( 'Comments must start with a lowercase letter', comment.loc.start ); } |
| ✓ Negative was executed (else) | /**··· * Requir }); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires the first alphabetical character !lowerCasePattern.test(firstChar)) { |
| ✓ Was returned | /**··· * Requires letterPattern.test(firstChar) && !lowerCasePattern.test(firstChar)) { |
| Function (anonymous_319) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_320) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(options) { var optionName = this.getOptionName(); if (typeof options !== 'object') { assert( options === true, optionName + ' option requires either a true value or an object' ); var _options = {allExcept: []}; return this.configure(_options); } assert( Array.isArray(options.allExcept), 'Property `allExcept` in ' + optionName + ' should be an array of strings' ); this._exceptFunction = options.allExcept.indexOf('function') > -1; }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows commas as last token on { assert( options === true, optionName + ' option requires either a true value or an object' ); var _options = {allExcept: []}; return this.configure(_options); } |
| ✓ Negative was executed (else) | /**··· * Di assert( |
| Function (anonymous_321) | |
|---|---|
| ✓ Was called | /**··· * Disallows cofunction() { return 'disallowCommaBeforeLineBreak'; }, |
| Function (anonymous_322) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { var exceptFunction = this._exceptFunction; function canSkip(token) { var node = file.getNodeByRange(token.range[0]); if (node.loc.start.line === node.loc.end.line) { return true; } // exception for function params if (node.params && node.params[0].loc.start.line === node.params[node.params.length - 1].loc.end.line) { return true; } // See #1841 if (!exceptFunction || !node.properties) { return false; } return node.properties.some(function(property) { return property.value.type === 'FunctionExpression'; }); } file.iterateTokensByTypeAndValue('Punctuator', ',', function(token) { var nextToken = file.getNextToken(token); if (canSkip(token) || nextToken.value === ',') { return; } errors.assert.sameLine({ token: token, nextToken: nextToken, message: 'Commas should be placed on the same line as value' }); errors.assert.differentLine({ token: file.getPrevToken(token), nextToken: token, message: 'Commas should be placed on new line' }); }); } |
| Function canSkip | |
|---|---|
| ✓ Was called | /**··· * Dfunction canSkip(token) { var node = file.getNodeByRange(token.range[0]); if (node.loc.start.line === node.loc.end.line) { return true; } // exception for function params if (node.params && node.params[0].loc.start.line === node.params[node.params.length - 1].loc.end.line) { return true; } // See #1841 if (!exceptFunction || !node.properties) { return false; } return node.properties.some(function(property) { return property.value.type === 'FunctionExpression'; }); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows commas as last token on a line in lists. { return true; } |
| ✓ Negative was executed (else) | /**··· * Disall // exception for function params |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows commas as last token on a line in lists. * * Type: `Boolean`, `Object` * * Valu{ return true; } |
| ✓ Negative was executed (else) | /**··· * Disall // See #1841 |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallowsnode.params[0].loc.start.line === node.params[node.params.length - 1].loc.end.line) { |
| ✓ Was returned | /**··· * Disallowsnode.params && |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows commas as last token on a line in li{ return false; } |
| ✓ Negative was executed (else) | /**··· * Disall return node.properties.some(function(property) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows commas as last tok!node.properties) { |
| ✓ Was returned | /**··· * Disallows!exceptFunction || !node.properties) { |
| Function (anonymous_324) | |
|---|---|
| ✓ Was called | /**··· * Disallows commas as last token onfunction(property) { return property.value.type === 'FunctionExpression'; }); |
| Function (anonymous_325) | |
|---|---|
| ✓ Was called | /**··· * Disallows commas as last token on a line in lists. *function(token) { var nextToken = file.getNextToken(token); if (canSkip(token) || nextToken.value === ',') { return; } errors.assert.sameLine({ token: token, nextToken: nextToken, message: 'Commas should be placed on the same line as value' }); errors.assert.differentLine({ token: file.getPrevToken(token), nextToken: token, message: 'Commas should be placed on new line' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows commas as last token on a line in lists. { return; } |
| ✓ Negative was executed (else) | /**··· * Disall errors.assert.sameLine({ |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows commas as last tonextToken.value === ',') { |
| ✓ Was returned | /**··· * DisallowscanSkip(token) || nextToken.value === ',') { |
| Function (anonymous_326) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_327) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(statementTypes) { assert( Array.isArray(statementTypes) || statementTypes === true, this.getOptionName() + ' option requires array or true value' ); if (statementTypes === true) { statementTypes = defaultKeywords; } this._typeIndex = {}; statementTypes.forEach(function(type) { this._typeIndex[type] = true; }.bind(this)); }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disallows curly braces after statementstatementTypes === true, |
| ✓ Was returned | /**··· * DisalArray.isArray(statementTypes) || statementTypes === true, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows curly braces after s{ statementTypes = defaultKeywords; } |
| ✓ Negative was executed (else) | /**··· * Di this._typeIndex = {}; |
| Function (anonymous_328) | |
|---|---|
| ✓ Was called | /**··· * Disallows curly braces afunction(type) { this._typeIndex[type] = true; }.bind(this)); |
| Function (anonymous_329) | |
|---|---|
| ✓ Was called | /**··· * Disallows cufunction() { return 'disallowCurlyBraces'; }, |
| Function (anonymous_330) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { function isSingleBlockStatement(node) { return node && node.type === 'BlockStatement' && node.body.length === 1; } function addError(typeString, entity) { errors.add( typeString + ' statement with extra curly braces', entity.loc.start.line, entity.loc.start.column ); } function checkBody(type, typeString) { file.iterateNodesByType(type, function(node) { if (isSingleBlockStatement(node.body)) { addError(typeString, node); } }); } var typeIndex = this._typeIndex; if (typeIndex.if || typeIndex.else) { file.iterateNodesByType('IfStatement', function(node) { if (typeIndex.if && isSingleBlockStatement(node.consequent)) { addError('If', node); } if (typeIndex.else && isSingleBlockStatement(node.alternate)) { addError('Else', file.getPrevToken(file.getFirstNodeToken(node.alternate))); } }); } if (typeIndex.while) { checkBody('WhileStatement', 'While'); } if (typeIndex.for) { checkBody('ForStatement', 'For'); checkBody('ForInStatement', 'For in'); checkBody('ForOfStatement', 'For of'); } if (typeIndex.do) { checkBody('DoWhileStatement', 'Do while'); } if (typeIndex.with) { checkBody('WithStatement', 'With'); } } |
| Function isSingleBlockStatement | |
|---|---|
| ✓ Was called | /**··· * Dfunction isSingleBlockStatement(node) { return node && node.type === 'BlockStatement' && node.body.length === 1; } |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disalnode.body.length === 1; |
| ✓ Was returned | /**··· * Disallows cunode && node.type === 'BlockStatement' && |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows curly bracnode.type === 'BlockStatement' && |
| ✓ Was returned | /**··· * Disallows cunode && node.type === 'BlockStatement' && |
| Function addError | |
|---|---|
| ✓ Was called | /**··· * Dfunction addError(typeString, entity) { errors.add( typeString + ' statement with extra curly braces', entity.loc.start.line, entity.loc.start.column ); } |
| Function checkBody | |
|---|---|
| ✓ Was called | /**··· * Dfunction checkBody(type, typeString) { file.iterateNodesByType(type, function(node) { if (isSingleBlockStatement(node.body)) { addError(typeString, node); } }); } |
| Function (anonymous_334) | |
|---|---|
| ✓ Was called | /**··· * Disallows curly braces after statemfunction(node) { if (isSingleBlockStatement(node.body)) { addError(typeString, node); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows curly braces after statements. * * T{ addError(typeString, node); } |
| ✓ Negative was executed (else) | /**··· * Disallows }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows curly braces after statemen{ file.iterateNodesByType('IfStatement', function(node) { if (typeIndex.if && isSingleBlockStatement(node.consequent)) { addError('If', node); } if (typeIndex.else && isSingleBlockStatement(node.alternate)) { addError('Else', file.getPrevToken(file.getFirstNodeToken(node.alternate))); } }); } |
| ✓ Negative was executed (else) | /**··· * Di if (typeIndex.while) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows curly bracetypeIndex.else) { |
| ✓ Was returned | /**··· * DisaltypeIndex.if || typeIndex.else) { |
| Function (anonymous_335) | |
|---|---|
| ✓ Was called | /**··· * Disallows curly braces after statements. * function(node) { if (typeIndex.if && isSingleBlockStatement(node.consequent)) { addError('If', node); } if (typeIndex.else && isSingleBlockStatement(node.alternate)) { addError('Else', file.getPrevToken(file.getFirstNodeToken(node.alternate))); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows curly braces after statements. * * Types: `Array` or `Bool{ addError('If', node); } |
| ✓ Negative was executed (else) | /**··· * Disallows if (typeIndex.else && isSingleBlockStatement(node.alternate)) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows curly braces after isSingleBlockStatement(node.consequent)) { |
| ✓ Was returned | /**··· * Disallows curtypeIndex.if && isSingleBlockStatement(node.consequent)) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows curly braces after statements. * * Types: `Array` or `Boole{ addError('Else', file.getPrevToken(file.getFirstNodeToken(node.alternate))); } |
| ✓ Negative was executed (else) | /**··· * Disallows }); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows curly braces after stisSingleBlockStatement(node.alternate)) { |
| ✓ Was returned | /**··· * Disallows curtypeIndex.else && isSingleBlockStatement(node.alternate)) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows curly braces{ checkBody('WhileStatement', 'While'); } |
| ✓ Negative was executed (else) | /**··· * Di if (typeIndex.for) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows curly brac{ checkBody('ForStatement', 'For'); checkBody('ForInStatement', 'For in'); checkBody('ForOfStatement', 'For of'); } |
| ✓ Negative was executed (else) | /**··· * Di if (typeIndex.do) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows curly bra{ checkBody('DoWhileStatement', 'Do while'); } |
| ✓ Negative was executed (else) | /**··· * Di if (typeIndex.with) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows curly brace{ checkBody('WithStatement', 'With'); } |
| ✓ Negative was executed (else) | /**··· * Di } |
| Function (anonymous_336) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_337) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(identifiers) { assert( identifiers === true || typeof identifiers === 'object', this.getOptionName() + ' option requires the value `true` ' + 'or an object with String[] `allExcept` property' ); // verify first item in `allExcept` property in object (if it's an object) assert( typeof identifiers !== 'object' || Array.isArray(identifiers.allExcept) && typeof identifiers.allExcept[0] === 'string', 'Property `allExcept` in ' + this.getOptionName() + ' should be an array of strings' ); var isTrue = identifiers === true; var defaultIdentifiers = [ '__proto__', '_', '__dirname', '__filename', 'super_' ]; if (isTrue) { identifiers = defaultIdentifiers; } else { identifiers = (identifiers.allExcept).concat(defaultIdentifiers); } this._identifierIndex = identifiers; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disaltypeof identifiers === 'object', |
| ✓ Was returned | /**··· * Disalidentifiers === true || |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * DisalArray.isArray(identifiers.allExcept) && typeof identifiers.allExcept[0] === 'string', |
| ✓ Was returned | /**··· * Disaltypeof identifiers !== 'object' || |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disaltypeof identifiers.allExcept[0] === 'string', |
| ✓ Was returned | /**··· * DisalArray.isArray(identifiers.allExcept) && |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows ide{ identifiers = defaultIdentifiers; } else { |
| ✓ Negative was executed (else) | /**··· * Disallow{ identifiers = (identifiers.allExcept).concat(defaultIdentifiers); } |
| Function (anonymous_338) | |
|---|---|
| ✓ Was called | /**··· * Disallows idfunction() { return 'disallowDanglingUnderscores'; }, |
| Function (anonymous_339) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { var allowedIdentifiers = this._identifierIndex; file.iterateTokensByType('Identifier', function(token) { var value = token.value; if ((value[0] === '_' || value.slice(-1) === '_') && allowedIdentifiers.indexOf(value) < 0 ) { errors.add( 'Invalid dangling underscore found', token.loc.start.line, token.loc.start.column ); } }); } |
| Function (anonymous_340) | |
|---|---|
| ✓ Was called | /**··· * Disallows identifiers that start or end function(token) { var value = token.value; if ((value[0] === '_' || value.slice(-1) === '_') && allowedIdentifiers.indexOf(value) < 0 ) { errors.add( 'Invalid dangling underscore found', token.loc.start.line, token.loc.start.column ); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallo{ errors.add( 'Invalid dangling underscore found', token.loc.start.line, token.loc.start.column ); } |
| ✓ Negative was executed (else) | /**··· * Disall }); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * DisallowsallowedIdentifiers.indexOf(value) < 0 |
| ✓ Was returned | /**··· * Disallows value[0] === '_' || value.slice(-1) === '_') && |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows identifiers that stavalue.slice(-1) === '_') && |
| ✓ Was returned | /**··· * Disallows value[0] === '_' || value.slice(-1) === '_') && |
| Function (anonymous_341) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_342) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(options) { var optionName = this.getOptionName(); if (typeof options !== 'object') { assert( options === true, optionName + ' option requires a true value or an object like: { allExcept: [\'comments\'] }' ); var _options = { allExcept: [] }; return this.configure(_options); } assert( Array.isArray(options.allExcept), 'Property `allExcept` in ' + optionName + ' should be an array of strings' ); this._exceptComments = options.allExcept.indexOf('comments') > -1; }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows empty blocks (except for{ assert( options === true, optionName + ' option requires a true value or an object like: { allExcept: [\'comments\'] }' ); var _options = { allExcept: [] }; return this.configure(_options); } |
| ✓ Negative was executed (else) | /**··· * Di assert( |
| Function (anonymous_343) | |
|---|---|
| ✓ Was called | /**··· * Disallows emfunction() { return 'disallowEmptyBlocks'; }, |
| Function (anonymous_344) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { var exceptComments = this._exceptComments; function canSkip(token) { if (!exceptComments) { return false; } var canSkipToken = false; file.getComments().forEach(function(comment) { if (comment.loc.start.line >= token.loc.start.line && comment.loc.end.line <= token.loc.end.line) { canSkipToken = true; } }); return canSkipToken; } file.iterateNodesByType('BlockStatement', function(node) { if (node.body.length) { return true; } if (canSkip(node)) { return true; } if (node.parentNode.type !== 'CatchClause' && node.parentNode.type !== 'FunctionDeclaration' && node.parentNode.type !== 'FunctionExpression' && node.parentNode.type !== 'ArrowFunctionExpression') { errors.add('Empty block found', node.loc.end); } }); } |
| Function canSkip | |
|---|---|
| ✓ Was called | /**··· * Dfunction canSkip(token) { if (!exceptComments) { return false; } var canSkipToken = false; file.getComments().forEach(function(comment) { if (comment.loc.start.line >= token.loc.start.line && comment.loc.end.line <= token.loc.end.line) { canSkipToken = true; } }); return canSkipToken; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows empty blocks (ex{ return false; } |
| ✓ Negative was executed (else) | /**··· * Disall var canSkipToken = false; |
| Function (anonymous_346) | |
|---|---|
| ✓ Was called | /**··· * Disallows empty blocks (except ffunction(comment) { if (comment.loc.start.line >= token.loc.start.line && comment.loc.end.line <= token.loc.end.line) { canSkipToken = true; } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows empty blocks (except for catch blocks). * * T{ canSkipToken = true; } |
| ✓ Negative was executed (else) | /**··· * Disallows }); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows empcomment.loc.end.line <= token.loc.end.line) { |
| ✓ Was returned | /**··· * Disallows empcomment.loc.start.line >= token.loc.start.line && |
| Function (anonymous_347) | |
|---|---|
| ✓ Was called | /**··· * Disallows empty blocks (except for catch blfunction(node) { if (node.body.length) { return true; } if (canSkip(node)) { return true; } if (node.parentNode.type !== 'CatchClause' && node.parentNode.type !== 'FunctionDeclaration' && node.parentNode.type !== 'FunctionExpression' && node.parentNode.type !== 'ArrowFunctionExpression') { errors.add('Empty block found', node.loc.end); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows empty blocks (exc{ return true; } |
| ✓ Negative was executed (else) | /**··· * Disall if (canSkip(node)) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows empty blocks ({ return true; } |
| ✓ Negative was executed (else) | /**··· * Disall if (node.parentNode.type !== 'CatchClause' && |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows empty blocks (except for catch blocks). * * Type:{ errors.add('Empty block found', node.loc.end); } |
| ✓ Negative was executed (else) | /**··· * Disall }); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallowsnode.parentNode.type !== 'ArrowFunctionExpression') { |
| ✓ Was returned | /**··· * Disallowsnode.parentNode.type !== 'CatchClause' && node.parentNode.type !== 'FunctionDeclaration' && node.parentNode.type !== 'FunctionExpression' && |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallowsnode.parentNode.type !== 'FunctionExpression' && |
| ✓ Was returned | /**··· * Disallowsnode.parentNode.type !== 'CatchClause' && node.parentNode.type !== 'FunctionDeclaration' && |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallowsnode.parentNode.type !== 'FunctionDeclaration' && |
| ✓ Was returned | /**··· * Disallowsnode.parentNode.type !== 'CatchClause' && |
| Function (anonymous_348) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_349) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(options) { assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_350) | |
|---|---|
| ✓ Was called | /**··· * Disallows fufunction() { return 'disallowFunctionDeclarations'; }, |
| Function (anonymous_351) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { file.iterateNodesByType('FunctionDeclaration', function(node) { errors.add('Illegal function declaration', node.loc.start); }); } |
| Function (anonymous_352) | |
|---|---|
| ✓ Was called | /**··· * Disallows function declarations. * * Type: `Bofunction(node) { errors.add('Illegal function declaration', node.loc.start); }); |
| Function (anonymous_353) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_354) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(options) { assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_355) | |
|---|---|
| ✓ Was called | /**··· * Disallows idfunction() { return 'disallowIdenticalDestructuringNames'; }, |
| Function (anonymous_356) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { file.iterateNodesByType(['ObjectPattern'], function(node) { var props = node.properties; for (var i = 0; i < props.length; i++) { var prop = props[i]; if (prop.type === 'Property' && !prop.shorthand && !prop.computed && prop.key.name === prop.value.name) { errors.add('Use the shorthand form of destructuring instead', prop.loc.start); } } }); } |
| Function (anonymous_357) | |
|---|---|
| ✓ Was called | /**··· * Disallows identical destructuring names for function(node) { var props = node.properties; for (var i = 0; i < props.length; i++) { var prop = props[i]; if (prop.type === 'Property' && !prop.shorthand && !prop.computed && prop.key.name === prop.value.name) { errors.add('Use the shorthand form of destructuring instead', prop.loc.start); } } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows identical destructuring names for the { errors.add('Use the shorthand form of destructuring instead', prop.loc.start); } |
| ✓ Negative was executed (else) | /**··· * Disallows } |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows ideprop.key.name === prop.value.name) { |
| ✓ Was returned | /**··· * Disallows ideprop.type === 'Property' && !prop.shorthand && !prop.computed && |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows identical destructuring names for the key and valu!prop.computed && |
| ✓ Was returned | /**··· * Disallows ideprop.type === 'Property' && !prop.shorthand && !prop.computed && |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows identical destructuring names f!prop.shorthand && !prop.computed && |
| ✗ Was not returned | /**··· * Disallows ideprop.type === 'Property' && !prop.shorthand && !prop.computed && |
| Function (anonymous_358) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_359) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(identifiers) { assert( Array.isArray(identifiers), 'disallowIdentifierNames option requires an array' ); this._identifierIndex = {}; for (var i = 0, l = identifiers.length; i < l; i++) { this._identifierIndex[identifiers[i]] = true; } }, |
| Function (anonymous_360) | |
|---|---|
| ✓ Was called | /**··· * Disallows a function() { return 'disallowIdentifierNames'; }, |
| Function (anonymous_361) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { var disallowedIdentifiers = this._identifierIndex; file.iterateNodesByType('Identifier', function(node) { if (Object.prototype.hasOwnProperty.call(disallowedIdentifiers, node.name)) { errors.add('Illegal Identifier name: ' + node.name, node.loc.start); } }); file.iterateNodesByType('MemberExpression', function(node) { if (node.property.type === 'Literal') { if (Object.prototype.hasOwnProperty.call(disallowedIdentifiers, node.property.value)) { errors.add('Illegal Identifier name: ' + node.property.value, node.property.loc.start); } } }); } |
| Function (anonymous_362) | |
|---|---|
| ✓ Was called | /**··· * Disallows a specified set of identifierfunction(node) { if (Object.prototype.hasOwnProperty.call(disallowedIdentifiers, node.name)) { errors.add('Illegal Identifier name: ' + node.name, node.loc.start); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows a specified set of identifier names. * * Type: `Array` * * Values: { errors.add('Illegal Identifier name: ' + node.name, node.loc.start); } |
| ✓ Negative was executed (else) | /**··· * Disall }); |
| Function (anonymous_363) | |
|---|---|
| ✓ Was called | /**··· * Disallows a specified set of identifier namesfunction(node) { if (node.property.type === 'Literal') { if (Object.prototype.hasOwnProperty.call(disallowedIdentifiers, node.property.value)) { errors.add('Illegal Identifier name: ' + node.property.value, node.property.loc.start); } } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows a specified set of identifier nam{ if (Object.prototype.hasOwnProperty.call(disallowedIdentifiers, node.property.value)) { errors.add('Illegal Identifier name: ' + node.property.value, node.property.loc.start); } } |
| ✓ Negative was executed (else) | /**··· * Disall }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows a specified set of identifier names. * * Type: `Array` * * Values: Array of strin{ errors.add('Illegal Identifier name: ' + node.property.value, node.property.loc.start); } |
| ✓ Negative was executed (else) | /**··· * Disallows } |
| Function (anonymous_364) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_365) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(types) { assert(Array.isArray(types), this.getOptionName() + ' option requires array value'); this._typeIndex = {}; for (var i = 0, l = types.length; i < l; i++) { this._typeIndex[types[i]] = true; } }, |
| Function (anonymous_366) | |
|---|---|
| ✓ Was called | /**··· * Disallows imfunction() { return 'disallowImplicitTypeConversion'; }, |
| Function (anonymous_367) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { var types = this._typeIndex; if (types.numeric || types.boolean || types.binary) { file.iterateNodesByType('UnaryExpression', function(node) { if (types.numeric && node.operator === '+') { errors.add('Implicit numeric conversion', node.loc.start); } if (types.binary && node.operator === '~') { errors.add('Implicit binary conversion', node.loc.start); } if (types.boolean && node.operator === '!' && node.argument.type === 'UnaryExpression' && node.argument.operator === '!' ) { errors.add('Implicit boolean conversion', node.loc.start); } }); } if (types.string) { file.iterateNodesByType('BinaryExpression', function(node) { if (node.operator !== '+') { return; } // Do not report concatination for same string literals (#1538) if (node.left.type === node.right.type) { return; } if ( (node.left.type === 'Literal' && node.left.value === '') || (node.right.type === 'Literal' && node.right.value === '') ) { errors.add('Implicit string conversion', node.loc.start); } }); } } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows implicit type conversion. * * Type: `Arra{ file.iterateNodesByType('UnaryExpression', function(node) { if (types.numeric && node.operator === '+') { errors.add('Implicit numeric conversion', node.loc.start); } if (types.binary && node.operator === '~') { errors.add('Implicit binary conversion', node.loc.start); } if (types.boolean && node.operator === '!' && node.argument.type === 'UnaryExpression' && node.argument.operator === '!' ) { errors.add('Implicit boolean conversion', node.loc.start); } }); } |
| ✓ Negative was executed (else) | /**··· * Di if (types.string) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows implicit type conversion. * types.binary) { |
| ✓ Was returned | /**··· * Disaltypes.numeric || types.boolean || types.binary) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows implicit typtypes.boolean || types.binary) { |
| ✓ Was returned | /**··· * Disaltypes.numeric || types.boolean || types.binary) { |
| Function (anonymous_368) | |
|---|---|
| ✓ Was called | /**··· * Disallows implicit type conversion. * * Type: function(node) { if (types.numeric && node.operator === '+') { errors.add('Implicit numeric conversion', node.loc.start); } if (types.binary && node.operator === '~') { errors.add('Implicit binary conversion', node.loc.start); } if (types.boolean && node.operator === '!' && node.argument.type === 'UnaryExpression' && node.argument.operator === '!' ) { errors.add('Implicit boolean conversion', node.loc.start); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows implicit type conversion. * * Type: `Arra{ errors.add('Implicit numeric conversion', node.loc.start); } |
| ✓ Negative was executed (else) | /**··· * Disallows if (types.binary && node.operator === '~') { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows implicit type convernode.operator === '+') { |
| ✓ Was returned | /**··· * Disallows imptypes.numeric && node.operator === '+') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows implicit type conversion. * * Type: `Arr{ errors.add('Implicit binary conversion', node.loc.start); } |
| ✓ Negative was executed (else) | /**··· * Disallows if (types.boolean && |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows implicit type convenode.operator === '~') { |
| ✓ Was returned | /**··· * Disallows imptypes.binary && node.operator === '~') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows i{ errors.add('Implicit boolean conversion', node.loc.start); } |
| ✓ Negative was executed (else) | /**··· * Disallows }); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows impnode.argument.operator === '!' |
| ✓ Was returned | /**··· * Disallows imptypes.boolean && node.operator === '!' && node.argument.type === 'UnaryExpression' && |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows impnode.argument.type === 'UnaryExpression' && |
| ✓ Was returned | /**··· * Disallows imptypes.boolean && node.operator === '!' && |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows impnode.operator === '!' && |
| ✓ Was returned | /**··· * Disallows imptypes.boolean && |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows implicit { file.iterateNodesByType('BinaryExpression', function(node) { if (node.operator !== '+') { return; } // Do not report concatination for same string literals (#1538) if (node.left.type === node.right.type) { return; } if ( (node.left.type === 'Literal' && node.left.value === '') || (node.right.type === 'Literal' && node.right.value === '') ) { errors.add('Implicit string conversion', node.loc.start); } }); } |
| ✓ Negative was executed (else) | /**··· * Di } |
| Function (anonymous_369) | |
|---|---|
| ✓ Was called | /**··· * Disallows implicit type conversion. * * Type: `function(node) { if (node.operator !== '+') { return; } // Do not report concatination for same string literals (#1538) if (node.left.type === node.right.type) { return; } if ( (node.left.type === 'Literal' && node.left.value === '') || (node.right.type === 'Literal' && node.right.value === '') ) { errors.add('Implicit string conversion', node.loc.start); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows implicit type conversion. { return; } |
| ✓ Negative was executed (else) | /**··· * Disallows // Do not report concatination for same string literals (#1538) |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows implicit type conversion. * * Type: `{ return; } |
| ✓ Negative was executed (else) | /**··· * Disallows if ( |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows i{ errors.add('Implicit string conversion', node.loc.start); } |
| ✓ Negative was executed (else) | /**··· * Disallows }); |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disallows implnode.right.type === 'Literal' && node.right.value === '') |
| ✓ Was returned | /**··· * Disallows implnode.left.type === 'Literal' && node.left.value === '') || |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows implicit type conversion. * * Typenode.left.value === '') || |
| ✓ Was returned | /**··· * Disallows implnode.left.type === 'Literal' && node.left.value === '') || |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disallows implicit type conversion. * * Type:node.right.value === '') |
| ✓ Was returned | /**··· * Disallows implnode.right.type === 'Literal' && node.right.value === '') |
| Function getCommentErrors | |
|---|---|
| ✓ Was called | function getCommentErrors(comment, keywordRegEx) {··· var splitComment = comment.value.split('\n'); var errors = []; splitComment.forEach(function(commentNode, index) { var lineIndex = index; var matches = commentNode.match(keywordRegEx); var lastIndex = -1; if (!matches) { return; } errors = errors.concat(matches.map(function(match) { lastIndex++; lastIndex = commentNode.indexOf(match, lastIndex); // line + lineIndex because comment block was split at new lines // will place carat at correct place within multiline comment // foundAtIndex += 2 because comment opening is stripped // +2 finds accurate carat position on opening line comment return { line: comment.loc.start.line + lineIndex, column: lastIndex + (lineIndex > 0 ? 0 : 2) }; })); }); return errors; } |
| Function (anonymous_371) | |
|---|---|
| ✓ Was called | /**··· * Disallows keywordsfunction(commentNode, index) { var lineIndex = index; var matches = commentNode.match(keywordRegEx); var lastIndex = -1; if (!matches) { return; } errors = errors.concat(matches.map(function(match) { lastIndex++; lastIndex = commentNode.indexOf(match, lastIndex); // line + lineIndex because comment block was split at new lines // will place carat at correct place within multiline comment // foundAtIndex += 2 because comment opening is stripped // +2 finds accurate carat position on opening line comment return { line: comment.loc.start.line + lineIndex, column: lastIndex + (lineIndex > 0 ? 0 : 2) }; })); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows keywo{ return; } |
| ✓ Negative was executed (else) | /**··· * Disallows keywords in your errors = errors.concat(matches.map(function(match) { |
| Function (anonymous_372) | |
|---|---|
| ✓ Was called | /**··· * Disallows keywords in your comments,function(match) { lastIndex++; lastIndex = commentNode.indexOf(match, lastIndex); // line + lineIndex because comment block was split at new lines // will place carat at correct place within multiline comment // foundAtIndex += 2 because comment opening is stripped // +2 finds accurate carat position on opening line comment return { line: comment.loc.start.line + lineIndex, column: lastIndex + (lineIndex > 0 ? 0 : 2) }; })); |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | /**··· * Disallows keywords in your comments, such as T0 : 2) |
| ✓ Negative was returned (: ...) | /**··· * Disallows keywords in your comments, such as TODO 2) |
| Function (anonymous_373) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_374) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(keywords) { this._message = 'Comments cannot contain the following keywords: '; this._keywords = ['todo', 'fixme']; switch (true) { case Array.isArray(keywords): // use the array of strings provided to build RegExp pattern this._keywords = keywords; /* falls through */ case keywords: // use default keywords this._message += this._keywords.join(', '); this._keywordRegEx = new RegExp('\\b(' + this._keywords.join('|') + ')\\b', 'gi'); break; case typeof keywords === 'string': // use string passed in as the RegExp pattern this._message = 'Comments cannot contain keywords based on the expression you provided'; this._keywordRegEx = new RegExp(keywords, 'gi'); break; default: assert(false, this.getOptionName() + ' option requires a true value, a string or an array'); } }, |
| Branch SwitchStatement | |
|---|---|
| ✓ Was evaluated | /**··· * Disalcase Array.isArray(keywords): // use the array of strings provided to build RegExp pattern this._keywords = keywords; |
| ✓ Was evaluated | /**··· * Disalcase keywords: // use default keywords this._message += this._keywords.join(', '); this._keywordRegEx = new RegExp('\\b(' + this._keywords.join('|') + ')\\b', 'gi'); break; |
| ✓ Was evaluated | /**··· * Disalcase typeof keywords === 'string': // use string passed in as the RegExp pattern this._message = 'Comments cannot contain keywords based on the expression you provided'; this._keywordRegEx = new RegExp(keywords, 'gi'); break; |
| ✓ Was evaluated | /**··· * Disaldefault: assert(false, this.getOptionName() + ' option requires a true value, a string or an array'); |
| Function (anonymous_375) | |
|---|---|
| ✓ Was called | /**··· * Disallows kefunction() { return 'disallowKeywordsInComments'; }, |
| Function (anonymous_376) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { file.iterateTokensByType(['Line', 'Block'], function(comment) { getCommentErrors(comment, this._keywordRegEx).forEach(function(errorObj) { errors.add(this._message, errorObj); }.bind(this)); }.bind(this)); } |
| Function (anonymous_377) | |
|---|---|
| ✓ Was called | /**··· * Disallows keywords in your comments, such as function(comment) { getCommentErrors(comment, this._keywordRegEx).forEach(function(errorObj) { errors.add(this._message, errorObj); }.bind(this)); }.bind(this)); |
| Function (anonymous_378) | |
|---|---|
| ✓ Was called | /**··· * Disallows keywords in your comments, such as TODO or FIXME function(errorObj) { errors.add(this._message, errorObj); }.bind(this)); |
| Function isPreviousTokenAComment | |
|---|---|
| ✓ Was called | function isPreviousTokenAComment(token, file) {··· var prevToken = file.getPrevToken(token, {includeComments: true}); return (prevToken.type === 'Line' || prevToken.type === 'Block'); } |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disallows placing keywords on a neprevToken.type === 'Block'); |
| ✓ Was returned | /**··· * DisalprevToken.type === 'Line' || prevToken.type === 'Block'); |
| Function (anonymous_380) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_381) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(keywords) { assert(Array.isArray(keywords), this.getOptionName() + ' option requires array value'); this._keywords = keywords; }, |
| Function (anonymous_382) | |
|---|---|
| ✓ Was called | /**··· * Disallows plfunction() { return 'disallowKeywordsOnNewLine'; }, |
| Function (anonymous_383) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { file.iterateTokensByTypeAndValue('Keyword', this._keywords, function(token) { var prevToken = file.getPrevToken(token); if (token.value === 'else') { if (prevToken.value !== '}') { // Special case for #905, even though it contradicts rule meaning, // it makes more sense that way. return; } if (isPreviousTokenAComment(token, file)) { // Special case for #1421, to handle comments before the else return; } } // Special cases for #885, using while as the keyword contradicts rule meaning // but it is more efficient and reduces complexity of the code in this rule if (token.value === 'while') { var nodes = file.getNodesByFirstToken(token); if (nodes.length === 0) { // "while" that is part of a do will not return nodes as it is not a start token if (prevToken.value !== '}') { // allow "while" that is part of a "do while" with no braces to succeed return; } if (isPreviousTokenAComment(token, file)) { // Special case for #1421, to handle comments before the "while" of a "do while" return; } } else { // it is a "while" statement that is not part of a "do while" // , allow it to succeed even though it contradicts rule meaning return; } } errors.assert.sameLine({ token: prevToken, nextToken: token }); }); } |
| Function (anonymous_384) | |
|---|---|
| ✓ Was called | /**··· * Disallows placing keywords on a new line. * * Types: `Arrayfunction(token) { var prevToken = file.getPrevToken(token); if (token.value === 'else') { if (prevToken.value !== '}') { // Special case for #905, even though it contradicts rule meaning, // it makes more sense that way. return; } if (isPreviousTokenAComment(token, file)) { // Special case for #1421, to handle comments before the else return; } } // Special cases for #885, using while as the keyword contradicts rule meaning // but it is more efficient and reduces complexity of the code in this rule if (token.value === 'while') { var nodes = file.getNodesByFirstToken(token); if (nodes.length === 0) { // "while" that is part of a do will not return nodes as it is not a start token if (prevToken.value !== '}') { // allow "while" that is part of a "do while" with no braces to succeed return; } if (isPreviousTokenAComment(token, file)) { // Special case for #1421, to handle comments before the "while" of a "do while" return; } } else { // it is a "while" statement that is not part of a "do while" // , allow it to succeed even though it contradicts rule meaning return; } } errors.assert.sameLine({ token: prevToken, nextToken: token }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows placing keywords on a n{ if (prevToken.value !== '}') { // Special case for #905, even though it contradicts rule meaning, // it makes more sense that way. return; } if (isPreviousTokenAComment(token, file)) { // Special case for #1421, to handle comments before the else return; } } |
| ✓ Negative was executed (else) | /**··· * Disall // Special cases for #885, using while as the keyword contradicts rule meaning |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows placing keywords on a new li{ // Special case for #905, even though it contradicts rule meaning, // it makes more sense that way. return; } |
| ✓ Negative was executed (else) | /**··· * Disallows if (isPreviousTokenAComment(token, file)) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows placing keywords on a new line. * * Typ{ // Special case for #1421, to handle comments before the else return; } |
| ✓ Negative was executed (else) | /**··· * Disallows } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows placing keywords on a ne{ var nodes = file.getNodesByFirstToken(token); if (nodes.length === 0) { // "while" that is part of a do will not return nodes as it is not a start token if (prevToken.value !== '}') { // allow "while" that is part of a "do while" with no braces to succeed return; } if (isPreviousTokenAComment(token, file)) { // Special case for #1421, to handle comments before the "while" of a "do while" return; } } else { // it is a "while" statement that is not part of a "do while" // , allow it to succeed even though it contradicts rule meaning return; } } |
| ✓ Negative was executed (else) | /**··· * Disall errors.assert.sameLine({ |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows placing keywords on a n{ // "while" that is part of a do will not return nodes as it is not a start token if (prevToken.value !== '}') { // allow "while" that is part of a "do while" with no braces to succeed return; } if (isPreviousTokenAComment(token, file)) { // Special case for #1421, to handle comments before the "while" of a "do while" return; } } else { |
| ✓ Negative was executed (else) | /**··· * Disallows placin{ // it is a "while" statement that is not part of a "do while" // , allow it to succeed even though it contradicts rule meaning return; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows placing keywords on a new line. { // allow "while" that is part of a "do while" with no braces to succeed return; } |
| ✓ Negative was executed (else) | /**··· * Disallows plac if (isPreviousTokenAComment(token, file)) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows placing keywords on a new line. * * Types: { // Special case for #1421, to handle comments before the "while" of a "do while" return; } |
| ✓ Negative was executed (else) | /**··· * Disallows plac } else { |
| Function (anonymous_385) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_386) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(keywords) { assert(Array.isArray(keywords), this.getOptionName() + ' option requires array value'); this._keywords = keywords; }, |
| Function (anonymous_387) | |
|---|---|
| ✓ Was called | /**··· * Disallows usfunction() { return 'disallowKeywords'; }, |
| Function (anonymous_388) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { file.iterateTokensByTypeAndValue('Keyword', this._keywords, function(token) { errors.add( 'Illegal keyword: ' + token.value, token.loc.start ); }); } |
| Function (anonymous_389) | |
|---|---|
| ✓ Was called | /**··· * Disallows usage of specified keywords. * * Type: `Array` *function(token) { errors.add( 'Illegal keyword: ' + token.value, token.loc.start ); }); |
| Function (anonymous_390) | |
|---|---|
| ✓ Was called | /**··· * Requires lfunction() {}; |
| Function (anonymous_391) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { assert( options === true || options === 'smart', this.getOptionName() + ' option requires a true value or "smart"' ); this._options = options; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires lines to not conoptions === 'smart', |
| ✓ Was returned | /**··· * Requioptions === true || options === 'smart', |
| Function (anonymous_392) | |
|---|---|
| ✓ Was called | /**··· * Requires linfunction() { return 'disallowMixedSpacesAndTabs'; }, |
| Function (anonymous_393) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var test = this._options === true ? (/ \t|\t [^\*]|\t $/) : (/ \t/); file.getLinesWithCommentsRemoved().forEach(function(line, i) { if (line.match(test)) { errors.add('Mixed spaces and tabs found', i + 1, 0); } }); } |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | /**··· * Requir/ \t|\t [^\*]|\t $/) : |
| ✓ Negative was returned (: ...) | /**··· * Requir/ \t/); |
| Function (anonymous_394) | |
|---|---|
| ✓ Was called | /**··· * Requires lines to not contain both spaces anfunction(line, i) { if (line.match(test)) { errors.add('Mixed spaces and tabs found', i + 1, 0); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires lines to not conta{ errors.add('Mixed spaces and tabs found', i + 1, 0); } |
| ✓ Negative was executed (else) | /**··· * Requir }); |
| Function (anonymous_395) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_396) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(options) { assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_397) | |
|---|---|
| ✓ Was called | /**··· * Disallows thfunction() { return 'disallowMultiLineTernary'; }, |
| Function (anonymous_398) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { file.iterateNodesByType('ConditionalExpression', function(node) { errors.assert.sameLine({ token: node.test, nextToken: node.consequent, message: 'Illegal new line after test' }); errors.assert.sameLine({ token: node.consequent, nextToken: node.alternate, message: 'Illegal new line after consequent' }); }); } |
| Function (anonymous_399) | |
|---|---|
| ✓ Was called | /**··· * Disallows the test, consequent and alternate to befunction(node) { errors.assert.sameLine({ token: node.test, nextToken: node.consequent, message: 'Illegal new line after test' }); errors.assert.sameLine({ token: node.consequent, nextToken: node.alternate, message: 'Illegal new line after consequent' }); }); |
| Function (anonymous_400) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_401) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(options) { assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_402) | |
|---|---|
| ✓ Was called | /**··· * Disallows mufunction() { return 'disallowMultipleLineBreaks'; }, |
| Function (anonymous_403) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { // Iterate over all tokens (including comments) file.getTokens().forEach(function(token) { if (token.type === 'Whitespace') { return; } // If there are no trailing tokens, exit early var nextToken = file.getNextToken(token, {includeComments: true}); if (!nextToken) { return; } errors.assert.linesBetween({ token: token, nextToken: nextToken, atMost: 2 }); }); } |
| Function (anonymous_404) | |
|---|---|
| ✓ Was called | /**··· * Disallows multiple blank lfunction(token) { if (token.type === 'Whitespace') { return; } // If there are no trailing tokens, exit early var nextToken = file.getNextToken(token, {includeComments: true}); if (!nextToken) { return; } errors.assert.linesBetween({ token: token, nextToken: nextToken, atMost: 2 }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows multiple blank lines in a ro{ return; } |
| ✓ Negative was executed (else) | /**··· * Disall // If there are no trailing tokens, exit early |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows multiple bl{ return; } |
| ✓ Negative was executed (else) | /**··· * Disall errors.assert.linesBetween({ |
| Function (anonymous_405) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_406) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(options) { assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_407) | |
|---|---|
| ✓ Was called | /**··· * Disallows stfunction() { return 'disallowMultipleLineStrings'; }, |
| Function (anonymous_408) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { file.iterateTokensByType('String', function(token) { if (token.loc.start.line !== token.loc.end.line) { errors.add( 'Multiline strings are disallowed.', token.loc.start.line, token.loc.start.column ); } }); } |
| Function (anonymous_409) | |
|---|---|
| ✓ Was called | /**··· * Disallows strings that span multiplefunction(token) { if (token.loc.start.line !== token.loc.end.line) { errors.add( 'Multiline strings are disallowed.', token.loc.start.line, token.loc.start.column ); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows strings that span multiple lines without usi{ errors.add( 'Multiline strings are disallowed.', token.loc.start.line, token.loc.start.column ); } |
| ✓ Negative was executed (else) | /**··· * Disall }); |
| Function (anonymous_410) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_411) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(options) { assert( options === true || typeof options === 'object' && options.allowEOLComments === true, this.getOptionName() + ' option requires true value ' + 'or an object with `allowEOLComments` property' ); this.allowEOLComments = options.allowEOLComments; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disaltypeof options === 'object' && options.allowEOLComments === true, |
| ✓ Was returned | /**··· * Disaloptions === true || |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disaloptions.allowEOLComments === true, |
| ✓ Was returned | /**··· * Disaltypeof options === 'object' && |
| Function (anonymous_412) | |
|---|---|
| ✓ Was called | /**··· * Disallows mufunction() { return 'disallowMultipleSpaces'; }, |
| Function (anonymous_413) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { // Iterate over all tokens (including comments) var _this = this; file.getTokens().forEach(function(token) { if (token.type === 'Whitespace') { return; } // If there are no trailing tokens, exit early var nextToken = file.getNextToken(token, {includeComments: true}); if (!nextToken) { return; } // If we are allowing EOL comments and the next token is an EOL comment skip it // We don't need to check the current token since EOL comments must be on separate lines from the next one if (_this.allowEOLComments && nextToken.type === 'Line') { return; } // Verify we have at most 1 space between this token and the next (won't fail for different lines) errors.assert.spacesBetween({ token: token, nextToken: nextToken, atMost: 1 }); }); } |
| Function (anonymous_414) | |
|---|---|
| ✓ Was called | /**··· * Disallows multiple indentafunction(token) { if (token.type === 'Whitespace') { return; } // If there are no trailing tokens, exit early var nextToken = file.getNextToken(token, {includeComments: true}); if (!nextToken) { return; } // If we are allowing EOL comments and the next token is an EOL comment skip it // We don't need to check the current token since EOL comments must be on separate lines from the next one if (_this.allowEOLComments && nextToken.type === 'Line') { return; } // Verify we have at most 1 space between this token and the next (won't fail for different lines) errors.assert.spacesBetween({ token: token, nextToken: nextToken, atMost: 1 }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows multiple indentation charact{ return; } |
| ✓ Negative was executed (else) | /**··· * Disall // If there are no trailing tokens, exit early |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows multiple in{ return; } |
| ✓ Negative was executed (else) | /**··· * Disall // If we are allowing EOL comments and the next token is an EOL comment skip it |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows multiple indentation characters (tabs or spaces) bet{ return; } |
| ✓ Negative was executed (else) | /**··· * Disall // Verify we have at most 1 space between this token and the next (won't fail for different lines) |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows multiple indentation charnextToken.type === 'Line') { |
| ✓ Was returned | /**··· * Disallows_this.allowEOLComments && nextToken.type === 'Line') { |
| Function (anonymous_415) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_416) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(options) { // support for legacy options if (typeof options !== 'object') { assert( options === true || options === 'strict' || options === 'exceptUndefined', this.getOptionName() + ' option requires a true value, "strict", "exceptUndefined", or an object' ); var _options = { strict: options === 'strict', allExcept: [] }; if (options === 'exceptUndefined') { _options.allExcept.push('undefined'); } return this.configure(_options); } if (Array.isArray(options.allExcept)) { this._exceptUndefined = options.allExcept.indexOf('undefined') > -1; this._exceptRequire = options.allExcept.indexOf('require') > -1; } this._strictMode = options.strict === true; }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows multiple `var` declarati{ assert( options === true || options === 'strict' || options === 'exceptUndefined', this.getOptionName() + ' option requires a true value, "strict", "exceptUndefined", or an object' ); var _options = { strict: options === 'strict', allExcept: [] }; if (options === 'exceptUndefined') { _options.allExcept.push('undefined'); } return this.configure(_options); } |
| ✓ Negative was executed (else) | /**··· * Di if (Array.isArray(options.allExcept)) { |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disallowsoptions === 'exceptUndefined', |
| ✓ Was returned | /**··· * Disallowsoptions === true || options === 'strict' || |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallowsoptions === 'strict' || |
| ✓ Was returned | /**··· * Disallowsoptions === true || |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows multiple `var` declaration (ex{ _options.allExcept.push('undefined'); } |
| ✓ Negative was executed (else) | /**··· * Disall return this.configure(_options); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows multiple `var` declaration (e{ this._exceptUndefined = options.allExcept.indexOf('undefined') > -1; this._exceptRequire = options.allExcept.indexOf('require') > -1; } |
| ✓ Negative was executed (else) | /**··· * Di this._strictMode = options.strict === true; |
| Function (anonymous_417) | |
|---|---|
| ✓ Was called | /**··· * Disallows mufunction() { return 'disallowMultipleVarDecl'; }, |
| Function (anonymous_418) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { function isSourcedFromRequire(node) { // If this node is a CallExpression it has a callee, // check if this is the `require` function if (node.callee && node.callee.name === 'require') { return true; } // If this CallExpression is not a `require` we keep looking for // the `require` method up in the tree if (node.callee && node.callee.object) { return isSourcedFromRequire(node.callee.object); } // If there is no `callee` this might be a MemberExpression, keep // look for the `require` method up in the tree. if (node.object) { return isSourcedFromRequire(node.object); } return false; } var inStrictMode = this._strictMode; var exceptUndefined = this._exceptUndefined; var exceptRequire = this._exceptRequire; file.iterateNodesByType('VariableDeclaration', function(node) { var definedVariables = node.declarations.filter(function(declaration) { return !!declaration.init; }); var hasDefinedVariables = definedVariables.length > 0; var requireStatements = node.declarations.filter(function(declaration) { var init = declaration.init; return init && isSourcedFromRequire(init); }); var allRequireStatements = requireStatements.length === node.declarations.length; var isForStatement = node.parentNode.type === 'ForStatement'; // allow single var declarations if (node.declarations.length === 1) { return; } // allow multiple var declarations in for statement unless we're in strict mode // for (var i = 0, j = myArray.length; i < j; i++) {} if (!inStrictMode && isForStatement) { return; } // allow multiple var declarations with all undefined variables in exceptUndefined mode // var a, b, c if (exceptUndefined && !hasDefinedVariables) { return; } // allow multiple var declaration with all require // var a = require("a"), b = require("b") if (exceptRequire && allRequireStatements) { return; } // allow multiple var declarations only with require && undefined // var a = require("a"), b = require("b"), x, y if (exceptUndefined && exceptRequire && definedVariables.length === requireStatements.length) { return; } errors.add('Multiple var declaration', node.loc.start); }); } |
| Function isSourcedFromRequire | |
|---|---|
| ✓ Was called | /**··· * Dfunction isSourcedFromRequire(node) { // If this node is a CallExpression it has a callee, // check if this is the `require` function if (node.callee && node.callee.name === 'require') { return true; } // If this CallExpression is not a `require` we keep looking for // the `require` method up in the tree if (node.callee && node.callee.object) { return isSourcedFromRequire(node.callee.object); } // If there is no `callee` this might be a MemberExpression, keep // look for the `require` method up in the tree. if (node.object) { return isSourcedFromRequire(node.object); } return false; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows multiple `var` declaration (except for-loop). { return true; } |
| ✓ Negative was executed (else) | /**··· * Disall // If this CallExpression is not a `require` we keep looking for |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows multiple `var`node.callee.name === 'require') { |
| ✓ Was returned | /**··· * Disallowsnode.callee && node.callee.name === 'require') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows multiple `var` declaration (except{ return isSourcedFromRequire(node.callee.object); } |
| ✓ Negative was executed (else) | /**··· * Disall // If there is no `callee` this might be a MemberExpression, keep |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows multiple `var`node.callee.object) { |
| ✓ Was returned | /**··· * Disallowsnode.callee && node.callee.object) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows multiple `va{ return isSourcedFromRequire(node.object); } |
| ✓ Negative was executed (else) | /**··· * Disall return false; |
| Function (anonymous_420) | |
|---|---|
| ✓ Was called | /**··· * Disallows multiple `var` declaration (except forfunction(node) { var definedVariables = node.declarations.filter(function(declaration) { return !!declaration.init; }); var hasDefinedVariables = definedVariables.length > 0; var requireStatements = node.declarations.filter(function(declaration) { var init = declaration.init; return init && isSourcedFromRequire(init); }); var allRequireStatements = requireStatements.length === node.declarations.length; var isForStatement = node.parentNode.type === 'ForStatement'; // allow single var declarations if (node.declarations.length === 1) { return; } // allow multiple var declarations in for statement unless we're in strict mode // for (var i = 0, j = myArray.length; i < j; i++) {} if (!inStrictMode && isForStatement) { return; } // allow multiple var declarations with all undefined variables in exceptUndefined mode // var a, b, c if (exceptUndefined && !hasDefinedVariables) { return; } // allow multiple var declaration with all require // var a = require("a"), b = require("b") if (exceptRequire && allRequireStatements) { return; } // allow multiple var declarations only with require && undefined // var a = require("a"), b = require("b"), x, y if (exceptUndefined && exceptRequire && definedVariables.length === requireStatements.length) { return; } errors.add('Multiple var declaration', node.loc.start); }); |
| Function (anonymous_421) | |
|---|---|
| ✓ Was called | /**··· * Disallows multiple `var` declaration (except for-loopfunction(declaration) { return !!declaration.init; }); |
| Function (anonymous_422) | |
|---|---|
| ✓ Was called | /**··· * Disallows multiple `var` declaration (except for-loop)function(declaration) { var init = declaration.init; return init && isSourcedFromRequire(init); }); |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disallows multiple `var`isSourcedFromRequire(init); |
| ✓ Was returned | /**··· * Disallows multipinit && isSourcedFromRequire(init); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows multiple `var` declaration (exc{ return; } |
| ✓ Negative was executed (else) | /**··· * Disall // allow multiple var declarations in for statement unless we're in strict mode |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows multiple `var` declaration (exce{ return; } |
| ✓ Negative was executed (else) | /**··· * Disall // allow multiple var declarations with all undefined variables in exceptUndefined mode |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows multiple `var` disForStatement) { |
| ✓ Was returned | /**··· * Disallows!inStrictMode && isForStatement) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows multiple `var` declaration (except for-l{ return; } |
| ✓ Negative was executed (else) | /**··· * Disall // allow multiple var declaration with all require |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows multiple `var` dec!hasDefinedVariables) { |
| ✓ Was returned | /**··· * DisallowsexceptUndefined && !hasDefinedVariables) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows multiple `var` declaration (except for{ return; } |
| ✓ Negative was executed (else) | /**··· * Disall // allow multiple var declarations only with require && undefined |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows multiple `var` dallRequireStatements) { |
| ✓ Was returned | /**··· * DisallowsexceptRequire && allRequireStatements) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows multiple `var` declaration (except for-loop). * * Types: `Boolean` or `Object` * * Va{ return; } |
| ✓ Negative was executed (else) | /**··· * Disall errors.add('Multiple var declaration', node.loc.start); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows multiple `var` declaration (except definedVariables.length === requireStatements.length) { |
| ✓ Was returned | /**··· * DisallowsexceptUndefined && exceptRequire && definedVariables.length === requireStatements.length) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows multiple `var` decexceptRequire && definedVariables.length === requireStatements.length) { |
| ✓ Was returned | /**··· * DisallowsexceptUndefined && exceptRequire && definedVariables.length === requireStatements.length) { |
| Function (anonymous_423) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_424) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(options) { assert( options === true, this.getOptionName() + ' option requires true value' ); }, |
| Function (anonymous_425) | |
|---|---|
| ✓ Was called | /**··· * Disallows unfunction() { return 'disallowNamedUnassignedFunctions'; }, |
| Function (anonymous_426) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { file.iterateNodesByType('FunctionExpression', function(node) { // If the function has been named via left hand assignment, skip it // e.g. `var hello = function() {`, `foo.bar = function() {` if (node.parentNode.type.match(/VariableDeclarator|Property|AssignmentExpression/)) { return; } // If the function has not been named, skip it // e.g. `[].forEach(function() {` if (node.id === null) { return; } // Otherwise, complain that it is being named errors.add('Inline functions cannot be named', node.loc.start); }); } |
| Function (anonymous_427) | |
|---|---|
| ✓ Was called | /**··· * Disallows unassigned functions to be named inlifunction(node) { // If the function has been named via left hand assignment, skip it // e.g. `var hello = function() {`, `foo.bar = function() {` if (node.parentNode.type.match(/VariableDeclarator|Property|AssignmentExpression/)) { return; } // If the function has not been named, skip it // e.g. `[].forEach(function() {` if (node.id === null) { return; } // Otherwise, complain that it is being named errors.add('Inline functions cannot be named', node.loc.start); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows unassigned functions to be named inline * * Type: `Boolean` * * Value: `tru{ return; } |
| ✓ Negative was executed (else) | /**··· * Disall // If the function has not been named, skip it |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows unassigned functi{ return; } |
| ✓ Negative was executed (else) | /**··· * Disall // Otherwise, complain that it is being named |
| Function (anonymous_428) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_429) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(options) { assert( options === true || (typeof options.maxLevel === 'number' && options.maxLevel > 0), this.getOptionName() + ' option requires a true value or an object with "maxLevel" property' ); this._maxLevel = 0; if (options.maxLevel) { this._maxLevel = options.maxLevel; } }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disallows nested ternariestypeof options.maxLevel === 'number' && options.maxLevel > 0), |
| ✓ Was returned | /**··· * Disaloptions === true || (typeof options.maxLevel === 'number' && options.maxLevel > 0), |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows nested ternaries. * * Types: `Boolean`, `Integer` * options.maxLevel > 0), |
| ✗ Was not returned | /**··· * Disallows nested ternariestypeof options.maxLevel === 'number' && options.maxLevel > 0), |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows nested ternar{ this._maxLevel = options.maxLevel; } |
| ✓ Negative was executed (else) | /**··· * Di }, |
| Function (anonymous_430) | |
|---|---|
| ✓ Was called | /**··· * Disallows nefunction() { return 'disallowNestedTernaries'; }, |
| Function (anonymous_431) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { var maxLevel = this._maxLevel; file.iterateNodesByType('ConditionalExpression', function(node) { var level = 0; var getLevel = function(currentNode) { if (currentNode.parentNode && currentNode.parentNode.type === 'ConditionalExpression') { level += 1; if (level > maxLevel) { errors.add('Illegal nested ternary', node.loc.start.line, node.loc.start.column); return; } getLevel(currentNode.parentNode); } }; getLevel(node); }); } |
| Function (anonymous_432) | |
|---|---|
| ✓ Was called | /**··· * Disallows nested ternaries. * * Types: `Boolean`function(node) { var level = 0; var getLevel = function(currentNode) { if (currentNode.parentNode && currentNode.parentNode.type === 'ConditionalExpression') { level += 1; if (level > maxLevel) { errors.add('Illegal nested ternary', node.loc.start.line, node.loc.start.column); return; } getLevel(currentNode.parentNode); } }; getLevel(node); }); |
| Function (anonymous_433) | |
|---|---|
| ✓ Was called | /**··· * Disallows nested terfunction(currentNode) { if (currentNode.parentNode && currentNode.parentNode.type === 'ConditionalExpression') { level += 1; if (level > maxLevel) { errors.add('Illegal nested ternary', node.loc.start.line, node.loc.start.column); return; } getLevel(currentNode.parentNode); } }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows nested ternaries. * * Types: `Boolean`, `Integer` * * Values: `true` or an Integer{ level += 1; if (level > maxLevel) { errors.add('Illegal nested ternary', node.loc.start.line, node.loc.start.column); return; } getLevel(currentNode.parentNode); } |
| ✓ Negative was executed (else) | /**··· * Disallows }; |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows nested ternaries. * * TypescurrentNode.parentNode.type === 'ConditionalExpression') { |
| ✗ Was not returned | /**··· * Disallows nescurrentNode.parentNode && currentNode.parentNode.type === 'ConditionalExpression') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows nested ternaries. * * T{ errors.add('Illegal nested ternary', node.loc.start.line, node.loc.start.column); return; } |
| ✓ Negative was executed (else) | /**··· * Disallows nest getLevel(currentNode.parentNode); |
| Function (anonymous_434) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_435) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(options) { var settingValue; this._hasMultiLineEx = false; if (options.constructor === Object) { settingValue = options.value; if (options.allExcept) { assert( Array.isArray(options.allExcept) && options.allExcept.length === 1 && options.allExcept[0] === 'multiLine', 'allExcept option must be an array whose values can be only `multiLine`' ); this._hasMultiLineEx = true; } } else { settingValue = options; } assert( Array.isArray(settingValue) && settingValue.length || settingValue === true, 'disallowNewlineBeforeBlockStatements option requires non-empty array value or true value' ); this._setting = settingValue; }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows newline before opening curl{ settingValue = options.value; if (options.allExcept) { assert( Array.isArray(options.allExcept) && options.allExcept.length === 1 && options.allExcept[0] === 'multiLine', 'allExcept option must be an array whose values can be only `multiLine`' ); this._hasMultiLineEx = true; } } else { |
| ✓ Negative was executed (else) | /**··· * Disallow{ settingValue = options; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows newline before ope{ assert( Array.isArray(options.allExcept) && options.allExcept.length === 1 && options.allExcept[0] === 'multiLine', 'allExcept option must be an array whose values can be only `multiLine`' ); this._hasMultiLineEx = true; } |
| ✗ Negative was not executed (else) | /**··· * Disall } else { |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disallows newoptions.allExcept[0] === 'multiLine', |
| ✗ Was not returned | /**··· * Disallows newArray.isArray(options.allExcept) && options.allExcept.length === 1 && |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows newline before opening curly brace of aoptions.allExcept.length === 1 && |
| ✗ Was not returned | /**··· * Disallows newArray.isArray(options.allExcept) && options.allExcept.length === 1 && |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disallows newline before opening curly brace of all block ssettingValue === true, |
| ✓ Was returned | /**··· * DisalArray.isArray(settingValue) && settingValue.length || settingValue === true, |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows newline before opening cursettingValue.length || settingValue === true, |
| ✓ Was returned | /**··· * DisalArray.isArray(settingValue) && settingValue.length || settingValue === true, |
| Function (anonymous_436) | |
|---|---|
| ✓ Was called | /**··· * Disallows nefunction() { return 'disallowNewlineBeforeBlockStatements'; }, |
| Function (anonymous_437) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { var setting = this._setting; var hasMultiLineEx = this._hasMultiLineEx; function assertSameLine(token, nextToken) { errors.assert.sameLine({ token: token, nextToken: nextToken, message: 'Newline before curly brace for block statement is disallowed' }); } function assertDifferentLine(token, nextToken) { errors.assert.differentLine({ token: token, nextToken: nextToken, message: 'Newline before curly brace for block statement is required' }); } file.iterateNodesByType(['BlockStatement', 'ClassBody'], function(node) { if (isBareBlock(node)) { return; } if (setting === true || setting.indexOf(getBlockType(node)) !== -1) { var openingBrace = file.getFirstNodeToken(node); var prevToken = file.getPrevToken(openingBrace); if (hasMultiLineEx !== true) { assertSameLine(prevToken, openingBrace); return; } // Check if the 'conditions' span on multiple lines. // The simplest way is to check if the round braces are on different lines. // // For example: // // same line // for (var i = 0; i < length; i++) { // } // // // different lines: // for (var i = 0; // i < length; // i++) // { // } var parentNode = node.parentNode; var parentNextToken = file.getFirstNodeToken(parentNode); var openingRoundBrace = file.findNextToken(parentNextToken, 'Punctuator', '('); var closingRoundBrace = file.findPrevToken(openingBrace, 'Punctuator', ')'); // Not always the conditions are there: to check look for the presence of round braces. // For example: // try { // } ... if (openingRoundBrace && closingRoundBrace && openingRoundBrace.loc.start.line !== closingRoundBrace.loc.end.line) { assertDifferentLine(prevToken, openingBrace); } else { assertSameLine(prevToken, openingBrace); } } }); if (setting === true || setting.indexOf('switch') !== -1) { file.iterateNodesByType(['SwitchStatement'], function(node) { var openingBrace = file.findNextToken(file.getLastNodeToken(node.discriminant), 'Punctuator', '{'); var prevToken = file.getPrevToken(openingBrace); if (hasMultiLineEx !== true) { assertSameLine(prevToken, openingBrace); return; } var openingRoundBrace = file.findNextToken(file.getFirstNodeToken(node), 'Punctuator', '('); var closingRoundBrace = file.findPrevToken(openingBrace, 'Punctuator', ')'); if (openingRoundBrace.loc.start.line !== closingRoundBrace.loc.end.line) { assertDifferentLine(prevToken, openingBrace); } else { assertSameLine(prevToken, openingBrace); } }); } } |
| Function assertSameLine | |
|---|---|
| ✓ Was called | /**··· * Dfunction assertSameLine(token, nextToken) { errors.assert.sameLine({ token: token, nextToken: nextToken, message: 'Newline before curly brace for block statement is disallowed' }); } |
| Function assertDifferentLine | |
|---|---|
| ✓ Was called | /**··· * Dfunction assertDifferentLine(token, nextToken) { errors.assert.differentLine({ token: token, nextToken: nextToken, message: 'Newline before curly brace for block statement is required' }); } |
| Function (anonymous_440) | |
|---|---|
| ✓ Was called | /**··· * Disallows newline before opening curly brace of all block function(node) { if (isBareBlock(node)) { return; } if (setting === true || setting.indexOf(getBlockType(node)) !== -1) { var openingBrace = file.getFirstNodeToken(node); var prevToken = file.getPrevToken(openingBrace); if (hasMultiLineEx !== true) { assertSameLine(prevToken, openingBrace); return; } // Check if the 'conditions' span on multiple lines. // The simplest way is to check if the round braces are on different lines. // // For example: // // same line // for (var i = 0; i < length; i++) { // } // // // different lines: // for (var i = 0; // i < length; // i++) // { // } var parentNode = node.parentNode; var parentNextToken = file.getFirstNodeToken(parentNode); var openingRoundBrace = file.findNextToken(parentNextToken, 'Punctuator', '('); var closingRoundBrace = file.findPrevToken(openingBrace, 'Punctuator', ')'); // Not always the conditions are there: to check look for the presence of round braces. // For example: // try { // } ... if (openingRoundBrace && closingRoundBrace && openingRoundBrace.loc.start.line !== closingRoundBrace.loc.end.line) { assertDifferentLine(prevToken, openingBrace); } else { assertSameLine(prevToken, openingBrace); } } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows newline before ope{ return; } |
| ✓ Negative was executed (else) | /**··· * Disall if (setting === true || setting.indexOf(getBlockType(node)) !== -1) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows newline before opening curly brace of all block statements. * { var openingBrace = file.getFirstNodeToken(node); var prevToken = file.getPrevToken(openingBrace); if (hasMultiLineEx !== true) { assertSameLine(prevToken, openingBrace); return; } // Check if the 'conditions' span on multiple lines. // The simplest way is to check if the round braces are on different lines. // // For example: // // same line // for (var i = 0; i < length; i++) { // } // // // different lines: // for (var i = 0; // i < length; // i++) // { // } var parentNode = node.parentNode; var parentNextToken = file.getFirstNodeToken(parentNode); var openingRoundBrace = file.findNextToken(parentNextToken, 'Punctuator', '('); var closingRoundBrace = file.findPrevToken(openingBrace, 'Punctuator', ')'); // Not always the conditions are there: to check look for the presence of round braces. // For example: // try { // } ... if (openingRoundBrace && closingRoundBrace && openingRoundBrace.loc.start.line !== closingRoundBrace.loc.end.line) { assertDifferentLine(prevToken, openingBrace); } else { assertSameLine(prevToken, openingBrace); } } |
| ✓ Negative was executed (else) | /**··· * Disall }); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows newline before opensetting.indexOf(getBlockType(node)) !== -1) { |
| ✓ Was returned | /**··· * Disallowssetting === true || setting.indexOf(getBlockType(node)) !== -1) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows newline before opening curly{ assertSameLine(prevToken, openingBrace); return; } |
| ✓ Negative was executed (else) | /**··· * Disallows // Check if the 'conditions' span on multiple lines. |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows newline before opening curly brace of all block statements. * * Type: { assertDifferentLine(prevToken, openingBrace); } else { |
| ✓ Negative was executed (else) | /**··· * Disallows newlin{ assertSameLine(prevToken, openingBrace); } |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows newopeningRoundBrace.loc.start.line !== closingRoundBrace.loc.end.line) { |
| ✓ Was returned | /**··· * Disallows newopeningRoundBrace && closingRoundBrace && |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows newline before opening cclosingRoundBrace && |
| ✗ Was not returned | /**··· * Disallows newopeningRoundBrace && closingRoundBrace && |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows newline before opening curly brace of all block s{ file.iterateNodesByType(['SwitchStatement'], function(node) { var openingBrace = file.findNextToken(file.getLastNodeToken(node.discriminant), 'Punctuator', '{'); var prevToken = file.getPrevToken(openingBrace); if (hasMultiLineEx !== true) { assertSameLine(prevToken, openingBrace); return; } var openingRoundBrace = file.findNextToken(file.getFirstNodeToken(node), 'Punctuator', '('); var closingRoundBrace = file.findPrevToken(openingBrace, 'Punctuator', ')'); if (openingRoundBrace.loc.start.line !== closingRoundBrace.loc.end.line) { assertDifferentLine(prevToken, openingBrace); } else { assertSameLine(prevToken, openingBrace); } }); } |
| ✓ Negative was executed (else) | /**··· * Di } |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows newline before setting.indexOf('switch') !== -1) { |
| ✓ Was returned | /**··· * Disalsetting === true || setting.indexOf('switch') !== -1) { |
| Function (anonymous_441) | |
|---|---|
| ✓ Was called | /**··· * Disallows newline before opening curly brace of alfunction(node) { var openingBrace = file.findNextToken(file.getLastNodeToken(node.discriminant), 'Punctuator', '{'); var prevToken = file.getPrevToken(openingBrace); if (hasMultiLineEx !== true) { assertSameLine(prevToken, openingBrace); return; } var openingRoundBrace = file.findNextToken(file.getFirstNodeToken(node), 'Punctuator', '('); var closingRoundBrace = file.findPrevToken(openingBrace, 'Punctuator', ')'); if (openingRoundBrace.loc.start.line !== closingRoundBrace.loc.end.line) { assertDifferentLine(prevToken, openingBrace); } else { assertSameLine(prevToken, openingBrace); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows newline before opening curly{ assertSameLine(prevToken, openingBrace); return; } |
| ✓ Negative was executed (else) | /**··· * Disallows var openingRoundBrace = file.findNextToken(file.getFirstNodeToken(node), 'Punctuator', '('); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows newline before opening curly brace of all block statements. * * Type: { assertDifferentLine(prevToken, openingBrace); } else { |
| ✓ Negative was executed (else) | /**··· * Disallows newlin{ assertSameLine(prevToken, openingBrace); } |
| Function isBareBlock | |
|---|---|
| ✓ Was called | function isBareBlock(node) {··· var parentNode = node.parentNode; return parentNode && parentNode.type === 'BlockStatement' || parentNode.type === 'Program' || parentNode.body && parentNode.body.type === 'BlockStatement' && Array.isArray(parentNode.body); } |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· parentNode.body && parentNode.body.type === 'BlockStatement' && Array.isArray(parentNode.body); |
| ✓ Was returned | /**··· * DisaparentNode && parentNode.type === 'BlockStatement' || parentNode.type === 'Program' || |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· parentNode.type === 'Program' || |
| ✓ Was returned | /**··· * DisaparentNode && parentNode.type === 'BlockStatement' || |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· parentNode.type === 'BlockStatement' || |
| ✗ Was not returned | /**··· * DisaparentNode && |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disallows newline before opening curly brace of all block staArray.isArray(parentNode.body); |
| ✓ Was returned | /**··· parentNode.body && parentNode.body.type === 'BlockStatement' && Array.isArray(parentNode.body); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows newlinparentNode.body.type === 'BlockStatement' && Array.isArray(parentNode.body); |
| ✓ Was returned | /**··· parentNode.body && parentNode.body.type === 'BlockStatement' && Array.isArray(parentNode.body); |
| Function getBlockType | |
|---|---|
| ✓ Was called | function getBlockType(node) {··· var parentNode = node.parentNode; switch (parentNode.type) { case 'IfStatement': return (parentNode.alternate === node) ? 'else' : 'if'; case 'FunctionDeclaration': case 'FunctionExpression': case 'ArrowFunctionExpression': return 'function'; case 'ForStatement': case 'ForInStatement': case 'ForOfStatement': return 'for'; case 'WhileStatement': return 'while'; case 'DoWhileStatement': return 'do'; case 'TryStatement': return (parentNode.finalizer === node) ? 'finally' : 'try'; case 'CatchClause': return 'catch'; case 'ClassDeclaration': return 'class'; } } |
| Branch SwitchStatement | |
|---|---|
| ✓ Was evaluated | /**··· * Dcase 'IfStatement': return (parentNode.alternate === node) ? 'else' : 'if'; |
| ✓ Was evaluated | /**··· * Dcase 'FunctionDeclaration': |
| ✓ Was evaluated | /**··· * Dcase 'FunctionExpression': |
| ✓ Was evaluated | /**··· * Dcase 'ArrowFunctionExpression': return 'function'; |
| ✓ Was evaluated | /**··· * Dcase 'ForStatement': |
| ✓ Was evaluated | /**··· * Dcase 'ForInStatement': |
| ✓ Was evaluated | /**··· * Dcase 'ForOfStatement': return 'for'; |
| ✓ Was evaluated | /**··· * Dcase 'WhileStatement': return 'while'; |
| ✓ Was evaluated | /**··· * Dcase 'DoWhileStatement': return 'do'; |
| ✓ Was evaluated | /**··· * Dcase 'TryStatement': return (parentNode.finalizer === node) ? 'finally' : 'try'; |
| ✓ Was evaluated | /**··· * Dcase 'CatchClause': return 'catch'; |
| ✓ Was evaluated | /**··· * Dcase 'ClassDeclaration': return 'class'; |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | /**··· * Disallows newline before opening curly brace o'else' : 'if'; |
| ✓ Negative was returned (: ...) | /**··· * Disallows newline before opening curly brace of all blo'if'; |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | /**··· * Disallows newline before opening curly brace o'finally' : 'try'; |
| ✓ Negative was returned (: ...) | /**··· * Disallows newline before opening curly brace of all block 'try'; |
| Function (anonymous_444) | |
|---|---|
| ✓ Was called | /**··· * Disallow ufunction() {}; |
| Function (anonymous_445) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(nodeTypes) { assert( Array.isArray(nodeTypes), 'disallowNodeTypes option requires an array' ); this._nodeTypes = nodeTypes; }, |
| Function (anonymous_446) | |
|---|---|
| ✓ Was called | /**··· * Disallow usefunction() { return 'disallowNodeTypes'; }, |
| Function (anonymous_447) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { var disallowedNodeTypes = this._nodeTypes; file.iterateNodesByType(disallowedNodeTypes, function(node) { errors.add('Illegal use of disallowed node type: ' + node.type, node.loc.start); }); } |
| Function (anonymous_448) | |
|---|---|
| ✓ Was called | /**··· * Disallow use of certain node types (from Esprifunction(node) { errors.add('Illegal use of disallowed node type: ' + node.type, node.loc.start); }); |
| Function (anonymous_449) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_450) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(options) { assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_451) | |
|---|---|
| ✓ Was called | /**··· * Disallows thfunction() { return 'disallowNotOperatorsInConditionals'; }, |
| Function (anonymous_452) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { function hasNotOperator(test) { return test.type === 'UnaryExpression' && test.operator === '!'; } function hasNotEqualOperator(test) { return test.type === 'BinaryExpression' && test.operator === '!='; } function hasStrictNotEqualOperator(test) { return test.type === 'BinaryExpression' && test.operator === '!=='; } file.iterateNodesByType(['IfStatement', 'ConditionalExpression'], function(node) { var alternate = node.alternate; // check if the if statement has an else block if (node.type === 'IfStatement' && (!alternate || alternate.type !== 'BlockStatement')) { return; } var test = node.test; if (hasNotOperator(test)) { errors.add('Illegal use of not operator in if statement', test.loc.start); } if (hasNotEqualOperator(test)) { errors.add('Illegal use of not equal operator in if statement', test.loc.end); } if (hasStrictNotEqualOperator(test)) { errors.add('Illegal use of strict not equal operator in if statement', test.loc.end); } }); } |
| Function hasNotOperator | |
|---|---|
| ✓ Was called | /**··· * Dfunction hasNotOperator(test) { return test.type === 'UnaryExpression' && test.operator === '!'; } |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disallows the not, not equals, and strict not etest.operator === '!'; |
| ✓ Was returned | /**··· * Disallows thtest.type === 'UnaryExpression' && test.operator === '!'; |
| Function hasNotEqualOperator | |
|---|---|
| ✓ Was called | /**··· * Dfunction hasNotEqualOperator(test) { return test.type === 'BinaryExpression' && test.operator === '!='; } |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disallows the not, not equals, and strict not eqtest.operator === '!='; |
| ✓ Was returned | /**··· * Disallows thtest.type === 'BinaryExpression' && test.operator === '!='; |
| Function hasStrictNotEqualOperator | |
|---|---|
| ✓ Was called | /**··· * Dfunction hasStrictNotEqualOperator(test) { return test.type === 'BinaryExpression' && test.operator === '!=='; } |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disallows the not, not equals, and strict not eqtest.operator === '!=='; |
| ✓ Was returned | /**··· * Disallows thtest.type === 'BinaryExpression' && test.operator === '!=='; |
| Function (anonymous_456) | |
|---|---|
| ✓ Was called | /**··· * Disallows the not, not equals, and strict not equals operators in cfunction(node) { var alternate = node.alternate; // check if the if statement has an else block if (node.type === 'IfStatement' && (!alternate || alternate.type !== 'BlockStatement')) { return; } var test = node.test; if (hasNotOperator(test)) { errors.add('Illegal use of not operator in if statement', test.loc.start); } if (hasNotEqualOperator(test)) { errors.add('Illegal use of not equal operator in if statement', test.loc.end); } if (hasStrictNotEqualOperator(test)) { errors.add('Illegal use of strict not equal operator in if statement', test.loc.end); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows the not, not equals, and strict not equals operators in conditionals. * * Type: `{ return; } |
| ✓ Negative was executed (else) | /**··· * Disall var test = node.test; |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows the not, not equals, and strict!alternate || alternate.type !== 'BlockStatement')) { |
| ✓ Was returned | /**··· * Disallowsnode.type === 'IfStatement' && (!alternate || alternate.type !== 'BlockStatement')) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows the not, not equals, and strict not equals opalternate.type !== 'BlockStatement')) { |
| ✓ Was returned | /**··· * Disallows the not, not equals, and strict!alternate || alternate.type !== 'BlockStatement')) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows the not, not equals, { errors.add('Illegal use of not operator in if statement', test.loc.start); } |
| ✓ Negative was executed (else) | /**··· * Disall if (hasNotEqualOperator(test)) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows the not, not equals, and s{ errors.add('Illegal use of not equal operator in if statement', test.loc.end); } |
| ✓ Negative was executed (else) | /**··· * Disall if (hasStrictNotEqualOperator(test)) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows the not, not equals, and strict { errors.add('Illegal use of strict not equal operator in if statement', test.loc.end); } |
| ✓ Negative was executed (else) | /**··· * Disall }); |
| Function (anonymous_457) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_458) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(options) { assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_459) | |
|---|---|
| ✓ Was called | /**··· * Disallows plfunction() { return 'disallowObjectKeysOnNewLine'; }, |
| Function (anonymous_460) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { file.iterateNodesByType('ObjectExpression', function(node) { for (var i = 1; i < node.properties.length; i++) { var lastValueToken = file.getLastNodeToken(node.properties[i - 1].value); var comma = file.findNextToken(lastValueToken, 'Punctuator', ','); var firstKeyToken = file.getFirstNodeToken(node.properties[i].key); errors.assert.sameLine({ token: comma, nextToken: firstKeyToken, message: 'Object keys must go on a new line' }); } }); } |
| Function (anonymous_461) | |
|---|---|
| ✓ Was called | /**··· * Disallows placing object keys on new line * function(node) { for (var i = 1; i < node.properties.length; i++) { var lastValueToken = file.getLastNodeToken(node.properties[i - 1].value); var comma = file.findNextToken(lastValueToken, 'Punctuator', ','); var firstKeyToken = file.getFirstNodeToken(node.properties[i].key); errors.assert.sameLine({ token: comma, nextToken: firstKeyToken, message: 'Object keys must go on a new line' }); } }); |
| Function (anonymous_462) | |
|---|---|
| ✓ Was called | /**··· * Requires pfunction() {}; |
| Function (anonymous_463) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(operators) { assert(Array.isArray(operators) || operators === true, this.getOptionName() + ' option requires array or true value'); if (operators === true) { operators = defaultOperators; } this._operators = operators; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires putting certain operators ooperators === true, |
| ✓ Was returned | /**··· * RequiresArray.isArray(operators) || operators === true, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires putting certain { operators = defaultOperators; } |
| ✓ Negative was executed (else) | /**··· * Re this._operators = operators; |
| Function (anonymous_464) | |
|---|---|
| ✓ Was called | /**··· * Requires putfunction() { return 'disallowOperatorBeforeLineBreak'; }, |
| Function (anonymous_465) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { file.iterateTokensByTypeAndValue('Punctuator', this._operators, function(token) { errors.assert.sameLine({ token: token, nextToken: file.getNextToken(token), message: 'Operator needs to either be on the same line or after a line break.' }); }); } |
| Function (anonymous_466) | |
|---|---|
| ✓ Was called | /**··· * Requires putting certain operators on the next line rather than ofunction(token) { errors.assert.sameLine({ token: token, nextToken: file.getNextToken(token), message: 'Operator needs to either be on the same line or after a line break.' }); }); |
| Function (anonymous_467) | |
|---|---|
| ✓ Was called | /**··· * Disallow afunction() {}; |
| Function (anonymous_468) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(value) { assert( value === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_469) | |
|---|---|
| ✓ Was called | /**··· * Disallow a nfunction() { return 'disallowPaddingNewLinesAfterBlocks'; }, |
| Function (anonymous_470) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { file.iterateNodesByType('BlockStatement', function(node) { var endToken = file.getLastNodeToken(node); var nextToken = file.getNextToken(endToken); while (nextToken.type !== 'EOF') { if (endToken.loc.end.line === nextToken.loc.start.line) { endToken = nextToken; nextToken = file.getNextToken(nextToken); continue; } errors.assert.linesBetween({ token: endToken, nextToken: nextToken, atMost: 1, message: 'Extra newline after closing curly brace' }); return; } }); } |
| Function (anonymous_471) | |
|---|---|
| ✓ Was called | /**··· * Disallow a newline after blocks * * Type:function(node) { var endToken = file.getLastNodeToken(node); var nextToken = file.getNextToken(endToken); while (nextToken.type !== 'EOF') { if (endToken.loc.end.line === nextToken.loc.start.line) { endToken = nextToken; nextToken = file.getNextToken(nextToken); continue; } errors.assert.linesBetween({ token: endToken, nextToken: nextToken, atMost: 1, message: 'Extra newline after closing curly brace' }); return; } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallow a newline after blocks * * Type: `Boolean` * * Value{ endToken = nextToken; nextToken = file.getNextToken(nextToken); continue; } |
| ✓ Negative was executed (else) | /**··· * Disallow a errors.assert.linesBetween({ |
| Function (anonymous_472) | |
|---|---|
| ✓ Was called | /**··· * Disallow afunction() {}; |
| Function (anonymous_473) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(disallowPaddingNewLinesAfterUseStrict) { assert( disallowPaddingNewLinesAfterUseStrict === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_474) | |
|---|---|
| ✓ Was called | /**··· * Disallow a bfunction() { return 'disallowPaddingNewLinesAfterUseStrict'; }, |
| Function (anonymous_475) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { file.iterateNodesByType('ExpressionStatement', function(node) { var expression = node.expression; if (expression.type !== 'Literal' || expression.value !== 'use strict') { return; } var endOfNode = file.getLastNodeToken(node); var nextToken = file.getNextToken(endOfNode, { includeComments: true }); errors.assert.linesBetween({ atMost: 1, token: endOfNode, nextToken: nextToken }); }); } |
| Function (anonymous_476) | |
|---|---|
| ✓ Was called | /**··· * Disallow a blank line after `'use strict';` statfunction(node) { var expression = node.expression; if (expression.type !== 'Literal' || expression.value !== 'use strict') { return; } var endOfNode = file.getLastNodeToken(node); var nextToken = file.getNextToken(endOfNode, { includeComments: true }); errors.assert.linesBetween({ atMost: 1, token: endOfNode, nextToken: nextToken }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallow a blank line after `'use strict';` statements * * Values: `true` { return; } |
| ✓ Negative was executed (else) | /**··· * Disall var endOfNode = file.getLastNodeToken(node); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallow a blank line after `'use strict';expression.value !== 'use strict') { |
| ✓ Was returned | /**··· * Disallow expression.type !== 'Literal' || expression.value !== 'use strict') { |
| Function (anonymous_477) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_478) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(value) { assert( value === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_479) | |
|---|---|
| ✓ Was called | /**··· * Disallows nefunction() { return 'disallowPaddingNewLinesBeforeExport'; }, |
| Function (anonymous_480) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { file.iterateNodesByType('AssignmentExpression', function(node) { var left = node.left; if (!( left.object && left.object.name === 'module' && left.property && left.property.name === 'exports')) { return; } var firstToken = file.getFirstNodeToken(node); var prevToken = file.getPrevToken(firstToken, {includeComments: true}); errors.assert.linesBetween({ atMost: 1, token: prevToken, nextToken: firstToken, message: 'Unexpected extra newline before export' }); }); } |
| Function (anonymous_481) | |
|---|---|
| ✓ Was called | /**··· * Disallows newline before module.exports * * Typfunction(node) { var left = node.left; if (!( left.object && left.object.name === 'module' && left.property && left.property.name === 'exports')) { return; } var firstToken = file.getFirstNodeToken(node); var prevToken = file.getPrevToken(firstToken, {includeComments: true}); errors.assert.linesBetween({ atMost: 1, token: prevToken, nextToken: firstToken, message: 'Unexpected extra newline before export' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows newline before module.exports * { return; } |
| ✓ Negative was executed (else) | /**··· * Disall var firstToken = file.getFirstNodeToken(node); |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disallowsleft.property.name === 'exports')) { |
| ✓ Was returned | /**··· * Disallowsleft.object && left.object.name === 'module' && left.property && |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallowsleft.property && |
| ✓ Was returned | /**··· * Disallowsleft.object && left.object.name === 'module' && |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallowsleft.object.name === 'module' && |
| ✓ Was returned | /**··· * Disallowsleft.object && |
| Function (anonymous_482) | |
|---|---|
| ✓ Was called | /**··· * Disallow afunction() { }; |
| Function (anonymous_483) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(keywords) { assert(Array.isArray(keywords) || keywords === true, this.getOptionName() + ' option requires array or true value'); if (keywords === true) { keywords = defaultKeywords; } this._keywords = keywords; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disallow an empty line above the spkeywords === true, |
| ✓ Was returned | /**··· * DisallowArray.isArray(keywords) || keywords === true, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallow an empty line a{ keywords = defaultKeywords; } |
| ✓ Negative was executed (else) | /**··· * Di this._keywords = keywords; |
| Function (anonymous_484) | |
|---|---|
| ✓ Was called | /**··· * Disallow an function() { return 'disallowPaddingNewlinesBeforeKeywords'; }, |
| Function (anonymous_485) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { file.iterateTokensByTypeAndValue('Keyword', this._keywords, function(token) { errors.assert.linesBetween({ token: file.getPrevToken(token), nextToken: token, atMost: 1, message: 'Keyword `' + token.value + '` should not have an empty line above it' }); }); } |
| Function (anonymous_486) | |
|---|---|
| ✓ Was called | /**··· * Disallow an empty line above the specified keywords. * * Tyfunction(token) { errors.assert.linesBetween({ token: file.getPrevToken(token), nextToken: token, atMost: 1, message: 'Keyword `' + token.value + '` should not have an empty line above it' }); }); |
| Function (anonymous_487) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_488) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(value) { assert( value === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_489) | |
|---|---|
| ✓ Was called | /**··· * Disallows nefunction() { return 'disallowPaddingNewLinesBeforeLineComments'; }, |
| Function (anonymous_490) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { file.iterateTokensByType('Line', function(comment) { if (comment.loc.start.line === 1) { return; } errors.assert.linesBetween({ token: file.getPrevToken(comment, {includeComments: true}), nextToken: comment, atMost: 1, message: 'Line comments must not be preceded with a blank line' }); }); } |
| Function (anonymous_491) | |
|---|---|
| ✓ Was called | /**··· * Disallows newline before line commfunction(comment) { if (comment.loc.start.line === 1) { return; } errors.assert.linesBetween({ token: file.getPrevToken(comment, {includeComments: true}), nextToken: comment, atMost: 1, message: 'Line comments must not be preceded with a blank line' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows newline before line comments { return; } |
| ✓ Negative was executed (else) | /**··· * Disall errors.assert.linesBetween({ |
| Function (anonymous_492) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_493) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(options) { var optionName = this.getOptionName(); this._checkOpen = true; this._checkClose = true; if (typeof options === 'object') { assert(options.allExcept || options.open || options.close, optionName + 'option requires either "open", "close", "allExcept"'); if (options.allExcept) { assert(Array.isArray(options.allExcept), optionName + ' option requires "allExcept" to be an array'); assert(options.allExcept.length > 0, optionName + ' option requires "allExcept" to have at least one ' + 'item or be set to `true`'); this._exceptConditionals = options.allExcept.indexOf('conditionals') > -1; this._exceptFunctions = options.allExcept.indexOf('functions') > -1; } if (options.open || options.close) { assert(typeof options.open === 'boolean' && typeof options.close === 'boolean', this.getOptionName() + ' option requires the "open" and "close" ' + 'properties to be booleans'); this._checkOpen = options.open; this._checkClose = options.close; } } else { assert(options === true, this.getOptionName() + ' option requires either a true value, or an object'); } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows blocks from beginning or{ assert(options.allExcept || options.open || options.close, optionName + 'option requires either "open", "close", "allExcept"'); if (options.allExcept) { assert(Array.isArray(options.allExcept), optionName + ' option requires "allExcept" to be an array'); assert(options.allExcept.length > 0, optionName + ' option requires "allExcept" to have at least one ' + 'item or be set to `true`'); this._exceptConditionals = options.allExcept.indexOf('conditionals') > -1; this._exceptFunctions = options.allExcept.indexOf('functions') > -1; } if (options.open || options.close) { assert(typeof options.open === 'boolean' && typeof options.close === 'boolean', this.getOptionName() + ' option requires the "open" and "close" ' + 'properties to be booleans'); this._checkOpen = options.open; this._checkClose = options.close; } } else { |
| ✓ Negative was executed (else) | /**··· * Disallow{ assert(options === true, this.getOptionName() + ' option requires either a true value, or an object'); } |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disallows blocks from beginning or ending with 2 options.close, |
| ✓ Was returned | /**··· * Disallows bloptions.allExcept || options.open || options.close, |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows blocks from beginning ooptions.open || options.close, |
| ✓ Was returned | /**··· * Disallows bloptions.allExcept || options.open || options.close, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows blocks from beginn{ assert(Array.isArray(options.allExcept), optionName + ' option requires "allExcept" to be an array'); assert(options.allExcept.length > 0, optionName + ' option requires "allExcept" to have at least one ' + 'item or be set to `true`'); this._exceptConditionals = options.allExcept.indexOf('conditionals') > -1; this._exceptFunctions = options.allExcept.indexOf('functions') > -1; } |
| ✓ Negative was executed (else) | /**··· * Disall if (options.open || options.close) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows blocks from beginning or endin{ assert(typeof options.open === 'boolean' && typeof options.close === 'boolean', this.getOptionName() + ' option requires the "open" and "close" ' + 'properties to be booleans'); this._checkOpen = options.open; this._checkClose = options.close; } |
| ✓ Negative was executed (else) | /**··· * Disall } else { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows blocks from begoptions.close) { |
| ✓ Was returned | /**··· * Disallowsoptions.open || options.close) { |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disallows blocks from beginning or ending with 2 newltypeof options.close === 'boolean', |
| ✗ Was not returned | /**··· * Disallows blockstypeof options.open === 'boolean' && typeof options.close === 'boolean', |
| Function (anonymous_494) | |
|---|---|
| ✓ Was called | /**··· * Disallows blfunction() { return 'disallowPaddingNewlinesInBlocks'; }, |
| Function (anonymous_495) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { var exceptConditionals = this._exceptConditionals; var exceptFunctions = this._exceptFunctions; var checkOpen = this._checkOpen; var checkClose = this._checkClose; file.iterateNodesByType('BlockStatement', function(node) { var openingBracket; var closingBracket; if (exceptConditionals && node.parentNode.type === 'IfStatement' || exceptFunctions && (node.parentNode.type === 'FunctionExpression' || node.parentNode.type === 'FunctionDeclaration')) { return; } if (checkOpen === true) { openingBracket = file.getFirstNodeToken(node); errors.assert.linesBetween({ token: openingBracket, nextToken: file.getNextToken(openingBracket, {includeComments: true}), atMost: 1, message: 'Expected no padding newline after opening curly brace' }); } if (checkClose === true) { closingBracket = file.getLastNodeToken(node); errors.assert.linesBetween({ token: file.getPrevToken(closingBracket, {includeComments: true}), nextToken: closingBracket, atMost: 1, message: 'Expected no padding newline before closing curly brace' }); } }); } |
| Function (anonymous_496) | |
|---|---|
| ✓ Was called | /**··· * Disallows blocks from beginning or ending wfunction(node) { var openingBracket; var closingBracket; if (exceptConditionals && node.parentNode.type === 'IfStatement' || exceptFunctions && (node.parentNode.type === 'FunctionExpression' || node.parentNode.type === 'FunctionDeclaration')) { return; } if (checkOpen === true) { openingBracket = file.getFirstNodeToken(node); errors.assert.linesBetween({ token: openingBracket, nextToken: file.getNextToken(openingBracket, {includeComments: true}), atMost: 1, message: 'Expected no padding newline after opening curly brace' }); } if (checkClose === true) { closingBracket = file.getLastNodeToken(node); errors.assert.linesBetween({ token: file.getPrevToken(closingBracket, {includeComments: true}), nextToken: closingBracket, atMost: 1, message: 'Expected no padding newline before closing curly brace' }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows blocks from beginning or ending with 2 newlines.{ return; } |
| ✓ Negative was executed (else) | /**··· * Disall if (checkOpen === true) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * DisallowsexceptFunctions && (node.parentNode.type === 'FunctionExpression' || node.parentNode.type === 'FunctionDeclaration')) { |
| ✓ Was returned | /**··· * DisallowsexceptConditionals && node.parentNode.type === 'IfStatement' || |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows blocks from beginningnode.parentNode.type === 'IfStatement' || |
| ✓ Was returned | /**··· * DisallowsexceptConditionals && node.parentNode.type === 'IfStatement' || |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disallows blocks from beginninode.parentNode.type === 'FunctionExpression' || node.parentNode.type === 'FunctionDeclaration')) { |
| ✓ Was returned | /**··· * DisallowsexceptFunctions && (node.parentNode.type === 'FunctionExpression' || |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallowsnode.parentNode.type === 'FunctionDeclaration')) { |
| ✓ Was returned | /**··· * Disallows blocks from beginninode.parentNode.type === 'FunctionExpression' || |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows blocks from beginni{ openingBracket = file.getFirstNodeToken(node); errors.assert.linesBetween({ token: openingBracket, nextToken: file.getNextToken(openingBracket, {includeComments: true}), atMost: 1, message: 'Expected no padding newline after opening curly brace' }); } |
| ✓ Negative was executed (else) | /**··· * Disall if (checkClose === true) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows blocks from beginnin{ closingBracket = file.getLastNodeToken(node); errors.assert.linesBetween({ token: file.getPrevToken(closingBracket, {includeComments: true}), nextToken: closingBracket, atMost: 1, message: 'Expected no padding newline before closing curly brace' }); } |
| ✓ Negative was executed (else) | /**··· * Disall }); |
| Function (anonymous_497) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_498) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(value) { assert( value === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_499) | |
|---|---|
| ✓ Was called | /**··· * Disallows nefunction() { return 'disallowPaddingNewLinesInObjects'; }, |
| Function (anonymous_500) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { file.iterateNodesByType('ObjectExpression', function(node) { var openingBracket = file.getFirstNodeToken(node); var nextToken = file.getNextToken(openingBracket); if (nextToken.type === 'Punctuator' && nextToken.value === '}') { return; } errors.assert.sameLine({ token: openingBracket, nextToken: nextToken, message: 'Illegal newline after opening curly brace' }); var closingBracket = file.getLastNodeToken(node); errors.assert.sameLine({ token: file.getPrevToken(closingBracket), nextToken: closingBracket, message: 'Illegal newline before closing curly brace' }); }); } |
| Function (anonymous_501) | |
|---|---|
| ✓ Was called | /**··· * Disallows newlines adjacent to curly braces ifunction(node) { var openingBracket = file.getFirstNodeToken(node); var nextToken = file.getNextToken(openingBracket); if (nextToken.type === 'Punctuator' && nextToken.value === '}') { return; } errors.assert.sameLine({ token: openingBracket, nextToken: nextToken, message: 'Illegal newline after opening curly brace' }); var closingBracket = file.getLastNodeToken(node); errors.assert.sameLine({ token: file.getPrevToken(closingBracket), nextToken: closingBracket, message: 'Illegal newline before closing curly brace' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows newlines adjacent to curly braces in all object literals. { return; } |
| ✓ Negative was executed (else) | /**··· * Disall errors.assert.sameLine({ |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows newlines adjacent to curly braces nextToken.value === '}') { |
| ✓ Was returned | /**··· * DisallowsnextToken.type === 'Punctuator' && nextToken.value === '}') { |
| Function (anonymous_502) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_503) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(options) { assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_504) | |
|---|---|
| ✓ Was called | /**··· * Disallows pafunction() { return 'disallowParenthesesAroundArrowParam'; }, |
| Function (anonymous_505) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { function isWrapped(node) { var openParensToken = file.getPrevToken(file.getFirstNodeToken(node)); var closingParensToken = file.getNextToken(file.getLastNodeToken(node)); var closingTokenValue = closingParensToken ? closingParensToken.value : ''; return openParensToken.value + closingTokenValue === '()'; } file.iterateNodesByType('ArrowFunctionExpression', function(node) { if (node.params.length !== 1) { return; } var firstParam = node.params[0]; // Old Esprima var hasDefaultParameter = node.defaults && node.defaults.length === 1; // ESTree var hasDefaultParameterESTree = firstParam.type === 'AssignmentPattern'; var hasDestructuring = firstParam.type === 'ObjectPattern' || firstParam.type === 'ArrayPattern'; var hasRestElement = firstParam.type === 'RestElement'; if (hasDefaultParameter || hasDefaultParameterESTree || hasDestructuring || hasRestElement) { return; } if (isWrapped(firstParam)) { errors.add( 'Illegal wrap of arrow function expressions in parentheses', firstParam.loc.start ); } }); } |
| Function isWrapped | |
|---|---|
| ✓ Was called | /**··· * Dfunction isWrapped(node) { var openParensToken = file.getPrevToken(file.getFirstNodeToken(node)); var closingParensToken = file.getNextToken(file.getLastNodeToken(node)); var closingTokenValue = closingParensToken ? closingParensToken.value : ''; return openParensToken.value + closingTokenValue === '()'; } |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | /**··· * Disallows parentheses around arrow function expresclosingParensToken.value : ''; |
| ✗ Negative was not returned (: ...) | /**··· * Disallows parentheses around arrow function expressions with a single paramet''; |
| Function (anonymous_507) | |
|---|---|
| ✓ Was called | /**··· * Disallows parentheses around arrow function expressifunction(node) { if (node.params.length !== 1) { return; } var firstParam = node.params[0]; // Old Esprima var hasDefaultParameter = node.defaults && node.defaults.length === 1; // ESTree var hasDefaultParameterESTree = firstParam.type === 'AssignmentPattern'; var hasDestructuring = firstParam.type === 'ObjectPattern' || firstParam.type === 'ArrayPattern'; var hasRestElement = firstParam.type === 'RestElement'; if (hasDefaultParameter || hasDefaultParameterESTree || hasDestructuring || hasRestElement) { return; } if (isWrapped(firstParam)) { errors.add( 'Illegal wrap of arrow function expressions in parentheses', firstParam.loc.start ); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows parentheses around arrow { return; } |
| ✓ Negative was executed (else) | /**··· * Disall var firstParam = node.params[0]; |
| Branch LogicalExpression | |
|---|---|
| ✗ Was not returned | /**··· * Disallows parentheses around arrow function exprnode.defaults.length === 1; |
| ✓ Was returned | /**··· * Disallows parentheses around arnode.defaults && node.defaults.length === 1; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disallows parentheses around arrow function expressions with a singfirstParam.type === 'ArrayPattern'; |
| ✓ Was returned | /**··· * Disallows parentheses aroundfirstParam.type === 'ObjectPattern' || firstParam.type === 'ArrayPattern'; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows parentheses aro{ return; } |
| ✓ Negative was executed (else) | /**··· * Disall if (isWrapped(firstParam)) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * DisallowshasRestElement) { |
| ✓ Was returned | /**··· * DisallowshasDefaultParameter || hasDefaultParameterESTree || hasDestructuring || |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * DisallowshasDestructuring || |
| ✓ Was returned | /**··· * DisallowshasDefaultParameter || hasDefaultParameterESTree || |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * DisallowshasDefaultParameterESTree || |
| ✗ Was not returned | /**··· * DisallowshasDefaultParameter || |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows parentheses around arr{ errors.add( 'Illegal wrap of arrow function expressions in parentheses', firstParam.loc.start ); } |
| ✓ Negative was executed (else) | /**··· * Disall }); |
| Function (anonymous_508) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_509) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(options) { assert( options === true || options === 'allButReserved' || typeof options === 'object', this.getOptionName() + ' option requires a true value or an object' ); this._exceptReserved = options === 'allButReserved'; if (Array.isArray(options.allExcept)) { this._exceptReserved = options.allExcept.indexOf('reserved') !== -1; } }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disallows quoted keys in object if possible. * * Types:typeof options === 'object', |
| ✓ Was returned | /**··· * Disaloptions === true || options === 'allButReserved' || typeof options === 'object', |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows quoted keys in options === 'allButReserved' || typeof options === 'object', |
| ✓ Was returned | /**··· * Disaloptions === true || options === 'allButReserved' || typeof options === 'object', |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows quoted keys in object if poss{ this._exceptReserved = options.allExcept.indexOf('reserved') !== -1; } |
| ✓ Negative was executed (else) | /**··· * Di }, |
| Function (anonymous_510) | |
|---|---|
| ✓ Was called | /**··· * Disallows qufunction() { return 'disallowQuotedKeysInObjects'; }, |
| Function (anonymous_511) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { var KEY_NAME_RE = /^(0|[1-9][0-9]*|[a-zA-Z_$]+[\w$]*)$/; // number or identifier var exceptReserved = this._exceptReserved; file.iterateNodesByType('ObjectExpression', function(node) { node.properties.forEach(function(prop) { var key = prop.key; if (key.type === 'Literal' && typeof key.value === 'string' && KEY_NAME_RE.test(key.value) ) { if (exceptReserved && reservedWords.check(key.value, file.getDialect(), true)) { return; } errors.cast({ message: 'Extra quotes for key', column: prop.loc.start.column, line: prop.loc.start.line, additional: prop }); } }); }); }, |
| Function (anonymous_512) | |
|---|---|
| ✓ Was called | /**··· * Disallows quoted keys in object if possible. function(node) { node.properties.forEach(function(prop) { var key = prop.key; if (key.type === 'Literal' && typeof key.value === 'string' && KEY_NAME_RE.test(key.value) ) { if (exceptReserved && reservedWords.check(key.value, file.getDialect(), true)) { return; } errors.cast({ message: 'Extra quotes for key', column: prop.loc.start.column, line: prop.loc.start.line, additional: prop }); } }); }); |
| Function (anonymous_513) | |
|---|---|
| ✓ Was called | /**··· * Disallows quoted keys in objefunction(prop) { var key = prop.key; if (key.type === 'Literal' && typeof key.value === 'string' && KEY_NAME_RE.test(key.value) ) { if (exceptReserved && reservedWords.check(key.value, file.getDialect(), true)) { return; } errors.cast({ message: 'Extra quotes for key', column: prop.loc.start.column, line: prop.loc.start.line, additional: prop }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows q{ if (exceptReserved && reservedWords.check(key.value, file.getDialect(), true)) { return; } errors.cast({ message: 'Extra quotes for key', column: prop.loc.start.column, line: prop.loc.start.line, additional: prop }); } |
| ✓ Negative was executed (else) | /**··· * Disallows }); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows quoKEY_NAME_RE.test(key.value) |
| ✓ Was returned | /**··· * Disallows quokey.type === 'Literal' && typeof key.value === 'string' && |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows quotypeof key.value === 'string' && |
| ✓ Was returned | /**··· * Disallows quokey.type === 'Literal' && |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows quoted keys in object if possible. * * Types: `Boolean`, `String` or `Object` *{ return; } |
| ✓ Negative was executed (else) | /**··· * Disallows quot errors.cast({ |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows quoted keys in object if reservedWords.check(key.value, file.getDialect(), true)) { |
| ✓ Was returned | /**··· * Disallows quoted exceptReserved && reservedWords.check(key.value, file.getDialect(), true)) { |
| Function (anonymous_514) | |
|---|---|
| ✓ Was called | /**··· * Disfunction(file, error) { var node = error.additional; var token = file.getFirstNodeToken(node); token.value = token.value.slice(1, -1); } |
| Function (anonymous_515) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_516) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(options) { assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_517) | |
|---|---|
| ✓ Was called | /**··· * Disallows lifunction() { return 'disallowSemicolons'; }, |
| Function (anonymous_518) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { file.iterateTokensByTypeAndValue('Punctuator', ';', function(token) { var nextToken = file.getNextToken(token); var node = file.getNodeByRange(token.range[0]); // Ignore node exceptions if (node.type in nodeExceptions) { return; } // Ignore next token exceptions if (nextToken.value in tokenExceptions) { return; } if (nextToken.type === 'EOF' || nextToken.loc.end.line > token.loc.end.line) { errors.cast({ message: 'semicolons are disallowed at the end of a line.', line: token.loc.end.line, column: token.loc.end.column, additional: token }); } }); }, |
| Function (anonymous_519) | |
|---|---|
| ✓ Was called | /**··· * Disallows lines from ending in a semicolon. * * Typfunction(token) { var nextToken = file.getNextToken(token); var node = file.getNodeByRange(token.range[0]); // Ignore node exceptions if (node.type in nodeExceptions) { return; } // Ignore next token exceptions if (nextToken.value in tokenExceptions) { return; } if (nextToken.type === 'EOF' || nextToken.loc.end.line > token.loc.end.line) { errors.cast({ message: 'semicolons are disallowed at the end of a line.', line: token.loc.end.line, column: token.loc.end.column, additional: token }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows lines from ending in a semic{ return; } |
| ✓ Negative was executed (else) | /**··· * Disall // Ignore next token exceptions |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows lines from ending in a semicolon. { return; } |
| ✓ Negative was executed (else) | /**··· * Disall if (nextToken.type === 'EOF' || nextToken.loc.end.line > token.loc.end.line) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows lines from ending in a semicolon. * * Type: `Boolean` * * Value: `tr{ errors.cast({ message: 'semicolons are disallowed at the end of a line.', line: token.loc.end.line, column: token.loc.end.column, additional: token }); } |
| ✓ Negative was executed (else) | /**··· * Disall }); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows lines from ending in a seminextToken.loc.end.line > token.loc.end.line) { |
| ✓ Was returned | /**··· * DisallowsnextToken.type === 'EOF' || nextToken.loc.end.line > token.loc.end.line) { |
| Function (anonymous_520) | |
|---|---|
| ✓ Was called | /**··· * Disfunction(file, error) { file.removeToken(error.additional); } |
| Function (anonymous_521) | |
|---|---|
| ✓ Was called | /**··· * Require arfunction() {}; |
| Function (anonymous_522) | |
|---|---|
| ✓ Was called | /**··· * Require function(options) { assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_523) | |
|---|---|
| ✓ Was called | /**··· * Require arrofunction() { return 'disallowShorthandArrowFunctions'; }, |
| Function (anonymous_524) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { file.iterateNodesByType('ArrowFunctionExpression', function(node) { if (node.expression) { errors.add( 'Use arrow function with explicit block and explicit return', node.body.loc.start ); } }); } |
| Function (anonymous_525) | |
|---|---|
| ✓ Was called | /**··· * Require arrow functions to use a block statement (exfunction(node) { if (node.expression) { errors.add( 'Use arrow function with explicit block and explicit return', node.body.loc.start ); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Require arrow functions to{ errors.add( 'Use arrow function with explicit block and explicit return', node.body.loc.start ); } |
| ✓ Negative was executed (else) | /**··· * Requir }); |
| Function (anonymous_526) | |
|---|---|
| ✓ Was called | /**··· * Requires sfunction() {}; |
| Function (anonymous_527) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(operators) { var isTrue = operators === true; assert( Array.isArray(operators) || isTrue, this.getOptionName() + ' option requires array or true value' ); if (isTrue) { operators = allOperators; } this._operatorIndex = {}; for (var i = 0, l = operators.length; i < l; i++) { this._operatorIndex[operators[i]] = true; } }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires sticking binary operatorisTrue, |
| ✓ Was returned | /**··· * RequiArray.isArray(operators) || isTrue, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires stic{ operators = allOperators; } |
| ✓ Negative was executed (else) | /**··· * Re this._operatorIndex = {}; |
| Function (anonymous_528) | |
|---|---|
| ✓ Was called | /**··· * Requires stifunction() { return 'disallowSpaceAfterBinaryOperators'; }, |
| Function (anonymous_529) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var operators = this._operatorIndex; // Comma if (operators[',']) { file.iterateTokensByTypeAndValue('Punctuator', ',', function(token) { if (file.getNextToken(token).value === ',') { return; } errors.assert.noWhitespaceBetween({ token: token, nextToken: file.getNextToken(token), message: 'Operator , should stick to following expression' }); }); } // For everything else file.iterateNodesByType( ['BinaryExpression', 'AssignmentExpression', 'VariableDeclarator', 'LogicalExpression'], function(node) { var operator; var expression; if (node.type === 'VariableDeclarator') { expression = node.init; operator = '='; } else { operator = node.operator; expression = node.right; } if (expression === null) { return; } var operatorToken = file.findPrevOperatorToken( file.getFirstNodeToken(expression), operator ); var nextToken = file.getNextToken(operatorToken); if (operators[operator]) { errors.assert.noWhitespaceBetween({ token: operatorToken, nextToken: nextToken, message: 'Operator ' + operator + ' should stick to following expression' }); } } ); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires sticking bin{ file.iterateTokensByTypeAndValue('Punctuator', ',', function(token) { if (file.getNextToken(token).value === ',') { return; } errors.assert.noWhitespaceBetween({ token: token, nextToken: file.getNextToken(token), message: 'Operator , should stick to following expression' }); }); } |
| ✓ Negative was executed (else) | /**··· * Re // For everything else |
| Function (anonymous_530) | |
|---|---|
| ✓ Was called | /**··· * Requires sticking binary operators to the right. * * Tyfunction(token) { if (file.getNextToken(token).value === ',') { return; } errors.assert.noWhitespaceBetween({ token: token, nextToken: file.getNextToken(token), message: 'Operator , should stick to following expression' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires sticking binary operators to the right. * { return; } |
| ✓ Negative was executed (else) | /**··· * Requires s errors.assert.noWhitespaceBetween({ |
| Function (anonymous_531) | |
|---|---|
| ✓ Was called | /**··· * Requifunction(node) { var operator; var expression; if (node.type === 'VariableDeclarator') { expression = node.init; operator = '='; } else { operator = node.operator; expression = node.right; } if (expression === null) { return; } var operatorToken = file.findPrevOperatorToken( file.getFirstNodeToken(expression), operator ); var nextToken = file.getNextToken(operatorToken); if (operators[operator]) { errors.assert.noWhitespaceBetween({ token: operatorToken, nextToken: nextToken, message: 'Operator ' + operator + ' should stick to following expression' }); } } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires sticking binary operators to the right. { expression = node.init; operator = '='; } else { |
| ✓ Negative was executed (else) | /**··· * Requires stickin{ operator = node.operator; expression = node.right; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires sticking binary operators{ return; } |
| ✓ Negative was executed (else) | /**··· * Requires s var operatorToken = file.findPrevOperatorToken( |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires sticking binary operators{ errors.assert.noWhitespaceBetween({ token: operatorToken, nextToken: nextToken, message: 'Operator ' + operator + ' should stick to following expression' }); } |
| ✓ Negative was executed (else) | /**··· * Requires s } |
| Function (anonymous_532) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() { }; |
| Function (anonymous_533) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(options) { if (typeof options !== 'object') { assert( options === true, this.getOptionName() + ' option requires true value or an object' ); var _options = {allExcept: []}; return this.configure(_options); } assert( Array.isArray(options.allExcept), ' property `allExcept` in ' + this.getOptionName() + ' should be an array of strings' ); this._exceptSparseArrays = options.allExcept.indexOf('sparseArrays') >= 0; }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows spaces after commas * { assert( options === true, this.getOptionName() + ' option requires true value or an object' ); var _options = {allExcept: []}; return this.configure(_options); } |
| ✓ Negative was executed (else) | /**··· * Di assert( |
| Function (anonymous_534) | |
|---|---|
| ✓ Was called | /**··· * Disallows spfunction() { return 'disallowSpaceAfterComma'; }, |
| Function (anonymous_535) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { var exceptSparseArrays = this._exceptSparseArrays; file.iterateTokensByTypeAndValue('Punctuator', ',', function(token) { var nextToken = file.getNextToken(token); if (exceptSparseArrays && nextToken.value === ',') { return; } errors.assert.noWhitespaceBetween({ token: token, nextToken: nextToken, message: 'Illegal space after comma' }); }); } |
| Function (anonymous_536) | |
|---|---|
| ✓ Was called | /**··· * Disallows spaces after commas * * Types: `Boolean` function(token) { var nextToken = file.getNextToken(token); if (exceptSparseArrays && nextToken.value === ',') { return; } errors.assert.noWhitespaceBetween({ token: token, nextToken: nextToken, message: 'Illegal space after comma' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows spaces after commas * * Types: `Boolean` or { return; } |
| ✓ Negative was executed (else) | /**··· * Disall errors.assert.noWhitespaceBetween({ |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows spaces after commas nextToken.value === ',') { |
| ✓ Was returned | /**··· * DisallowsexceptSparseArrays && nextToken.value === ',') { |
| Function (anonymous_537) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_538) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(keywords) { assert( Array.isArray(keywords) || keywords === true, this.getOptionName() + ' option requires array or true value' ); if (keywords === true) { keywords = defaultKeywords; } this._keywords = keywords; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disallows space after keyword. keywords === true, |
| ✓ Was returned | /**··· * DisalArray.isArray(keywords) || keywords === true, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space after ke{ keywords = defaultKeywords; } |
| ✓ Negative was executed (else) | /**··· * Di this._keywords = keywords; |
| Function (anonymous_539) | |
|---|---|
| ✓ Was called | /**··· * Disallows spfunction() { return 'disallowSpaceAfterKeywords'; }, |
| Function (anonymous_540) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { file.iterateTokensByTypeAndValue('Keyword', this._keywords, function(token) { var nextToken = file.getNextToken(token); // Make an exception if the next token is not a Punctuator such as a Keyword or Identifier if (nextToken.type !== 'Punctuator') { return; } errors.assert.noWhitespaceBetween({ token: token, nextToken: nextToken }); }); } |
| Function (anonymous_541) | |
|---|---|
| ✓ Was called | /**··· * Disallows space after keyword. * * Types: `Array` or `Boolefunction(token) { var nextToken = file.getNextToken(token); // Make an exception if the next token is not a Punctuator such as a Keyword or Identifier if (nextToken.type !== 'Punctuator') { return; } errors.assert.noWhitespaceBetween({ token: token, nextToken: nextToken }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space after keyword. * * Types{ return; } |
| ✓ Negative was executed (else) | /**··· * Disall errors.assert.noWhitespaceBetween({ |
| Function (anonymous_542) | |
|---|---|
| ✓ Was called | /**··· * Requires tfunction() {}; |
| Function (anonymous_543) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_544) | |
|---|---|
| ✓ Was called | /**··· * Requires thafunction() { return 'disallowSpaceAfterLineComment'; }, |
| Function (anonymous_545) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { file.iterateTokensByType('Line', function(comment) { var value = comment.value; if (value.length > 0 && value[0] === ' ') { errors.add('Illegal space after line comment', comment.loc.start); } }); } |
| Function (anonymous_546) | |
|---|---|
| ✓ Was called | /**··· * Requires that a line comment (`//`function(comment) { var value = comment.value; if (value.length > 0 && value[0] === ' ') { errors.add('Illegal space after line comment', comment.loc.start); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires that a line comment (`//`) not be foll{ errors.add('Illegal space after line comment', comment.loc.start); } |
| ✓ Negative was executed (else) | /**··· * Requir }); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires that a line comment value[0] === ' ') { |
| ✓ Was returned | /**··· * Requires value.length > 0 && value[0] === ' ') { |
| Function (anonymous_547) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_548) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(options) { if (typeof options !== 'object') { assert( options === true || options === 'ignoreSingleLine' || options === 'ignoreMultiLine', this.getOptionName() + ' option requires a true value, "ignoreSingleLine", "ignoreMultiLine", or an object' ); var _options = { allExcept: [] }; if (options === 'ignoreSingleLine') { _options.allExcept.push('singleline'); } if (options === 'ignoreMultiLine') { _options.allExcept.push('multiline'); } return this.configure(_options); } else { assert( Array.isArray(options.allExcept), this.getOptionName() + ' option object requires allExcept array property' ); } this._exceptSingleline = options.allExcept.indexOf('singleline') > -1; this._exceptMultiline = options.allExcept.indexOf('multiline') > -1; this._exceptAligned = options.allExcept.indexOf('aligned') > -1; this._exceptMethod = options.allExcept.indexOf('method') > -1; assert( !this._exceptMultiline || !this._exceptAligned, this.getOptionName() + ' option allExcept property cannot contain `aligned` and `multiline` at the same time' ); assert( !this._exceptMultiline || !this._exceptSingleline, this.getOptionName() + ' option allExcept property cannot contain `singleline` and `multiline` at the same time' ); }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space after object keys.{ assert( options === true || options === 'ignoreSingleLine' || options === 'ignoreMultiLine', this.getOptionName() + ' option requires a true value, "ignoreSingleLine", "ignoreMultiLine", or an object' ); var _options = { allExcept: [] }; if (options === 'ignoreSingleLine') { _options.allExcept.push('singleline'); } if (options === 'ignoreMultiLine') { _options.allExcept.push('multiline'); } return this.configure(_options); } else { |
| ✓ Negative was executed (else) | /**··· * Disallow{ assert( Array.isArray(options.allExcept), this.getOptionName() + ' option object requires allExcept array property' ); } |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disallowsoptions === 'ignoreMultiLine', |
| ✓ Was returned | /**··· * Disallowsoptions === true || options === 'ignoreSingleLine' || |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallowsoptions === 'ignoreSingleLine' || |
| ✓ Was returned | /**··· * Disallowsoptions === true || |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space after object keys. * * { _options.allExcept.push('singleline'); } |
| ✓ Negative was executed (else) | /**··· * Disall if (options === 'ignoreMultiLine') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space after object keys. * *{ _options.allExcept.push('multiline'); } |
| ✓ Negative was executed (else) | /**··· * Disall return this.configure(_options); |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disallows space after object ke!this._exceptAligned, |
| ✓ Was returned | /**··· * Disal!this._exceptMultiline || !this._exceptAligned, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disallows space after object ke!this._exceptSingleline, |
| ✓ Was returned | /**··· * Disal!this._exceptMultiline || !this._exceptSingleline, |
| Function (anonymous_549) | |
|---|---|
| ✓ Was called | /**··· * Disallows spfunction() { return 'disallowSpaceAfterObjectKeys'; }, |
| Function (anonymous_550) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { var exceptSingleline = this._exceptSingleline; var exceptMultiline = this._exceptMultiline; var exceptAligned = this._exceptAligned; var exceptMethod = this._exceptMethod; file.iterateNodesByType('ObjectExpression', function(node) { var multiline = node.loc.start.line !== node.loc.end.line; if (exceptSingleline && !multiline) { return; } if (exceptMultiline && multiline) { return; } var maxKeyEndPos = 0; var tokens = []; node.properties.forEach(function(property) { if (property.shorthand || property.kind !== 'init' || (exceptMethod && property.method) || node.type === 'SpreadProperty') { return; } var keyToken = file.getLastNodeToken(property.key); if (property.computed === true) { keyToken = file.getNextToken(keyToken); } if (exceptAligned) { maxKeyEndPos = Math.max(maxKeyEndPos, keyToken.loc.end.column); } tokens.push(keyToken); }); var noSpace = true; if (exceptAligned) { var withoutSpace = 0; var alignedOnColon = 0; tokens.forEach(function(key) { var colon = file.getNextToken(key); var spaces = Math.abs(colon.range[0] - key.range[1]); if (spaces === 0) { withoutSpace++; } else if (spaces === maxKeyEndPos - key.loc.end.column) { alignedOnColon++; } }); noSpace = withoutSpace > alignedOnColon; } tokens.forEach(function(key) { var colon = file.getNextToken(key); var spaces = (exceptAligned && !noSpace) ? maxKeyEndPos - key.loc.end.column : 0; errors.assert.spacesBetween({ token: key, nextToken: colon, exactly: spaces, message: 'Illegal space after key', disallowNewLine: true }); }); }); } |
| Function (anonymous_551) | |
|---|---|
| ✓ Was called | /**··· * Disallows space after object keys. * * Typefunction(node) { var multiline = node.loc.start.line !== node.loc.end.line; if (exceptSingleline && !multiline) { return; } if (exceptMultiline && multiline) { return; } var maxKeyEndPos = 0; var tokens = []; node.properties.forEach(function(property) { if (property.shorthand || property.kind !== 'init' || (exceptMethod && property.method) || node.type === 'SpreadProperty') { return; } var keyToken = file.getLastNodeToken(property.key); if (property.computed === true) { keyToken = file.getNextToken(keyToken); } if (exceptAligned) { maxKeyEndPos = Math.max(maxKeyEndPos, keyToken.loc.end.column); } tokens.push(keyToken); }); var noSpace = true; if (exceptAligned) { var withoutSpace = 0; var alignedOnColon = 0; tokens.forEach(function(key) { var colon = file.getNextToken(key); var spaces = Math.abs(colon.range[0] - key.range[1]); if (spaces === 0) { withoutSpace++; } else if (spaces === maxKeyEndPos - key.loc.end.column) { alignedOnColon++; } }); noSpace = withoutSpace > alignedOnColon; } tokens.forEach(function(key) { var colon = file.getNextToken(key); var spaces = (exceptAligned && !noSpace) ? maxKeyEndPos - key.loc.end.column : 0; errors.assert.spacesBetween({ token: key, nextToken: colon, exactly: spaces, message: 'Illegal space after key', disallowNewLine: true }); }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space after object keys. * * { return; } |
| ✓ Negative was executed (else) | /**··· * Disall if (exceptMultiline && multiline) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows space after object !multiline) { |
| ✓ Was returned | /**··· * DisallowsexceptSingleline && !multiline) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space after object keys. * { return; } |
| ✓ Negative was executed (else) | /**··· * Disall var maxKeyEndPos = 0; |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows space after objectmultiline) { |
| ✓ Was returned | /**··· * DisallowsexceptMultiline && multiline) { |
| Function (anonymous_552) | |
|---|---|
| ✓ Was called | /**··· * Disallows space after object function(property) { if (property.shorthand || property.kind !== 'init' || (exceptMethod && property.method) || node.type === 'SpreadProperty') { return; } var keyToken = file.getLastNodeToken(property.key); if (property.computed === true) { keyToken = file.getNextToken(keyToken); } if (exceptAligned) { maxKeyEndPos = Math.max(maxKeyEndPos, keyToken.loc.end.column); } tokens.push(keyToken); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space after object keys. * * Type{ return; } |
| ✓ Negative was executed (else) | /**··· * Disallows var keyToken = file.getLastNodeToken(property.key); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows spanode.type === 'SpreadProperty') { |
| ✓ Was returned | /**··· * Disallows spaproperty.shorthand || property.kind !== 'init' || (exceptMethod && property.method) || |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows spacexceptMethod && property.method) || |
| ✓ Was returned | /**··· * Disallows spaproperty.shorthand || property.kind !== 'init' || |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows space after object keys. property.kind !== 'init' || |
| ✓ Was returned | /**··· * Disallows spaproperty.shorthand || property.kind !== 'init' || |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disallows space after object kproperty.method) || |
| ✓ Was returned | /**··· * Disallows spacexceptMethod && property.method) || |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space after object keys. * * { keyToken = file.getNextToken(keyToken); } |
| ✓ Negative was executed (else) | /**··· * Disallows if (exceptAligned) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space after object{ maxKeyEndPos = Math.max(maxKeyEndPos, keyToken.loc.end.column); } |
| ✓ Negative was executed (else) | /**··· * Disallows tokens.push(keyToken); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space after ob{ var withoutSpace = 0; var alignedOnColon = 0; tokens.forEach(function(key) { var colon = file.getNextToken(key); var spaces = Math.abs(colon.range[0] - key.range[1]); if (spaces === 0) { withoutSpace++; } else if (spaces === maxKeyEndPos - key.loc.end.column) { alignedOnColon++; } }); noSpace = withoutSpace > alignedOnColon; } |
| ✓ Negative was executed (else) | /**··· * Disall tokens.forEach(function(key) { |
| Function (anonymous_553) | |
|---|---|
| ✓ Was called | /**··· * Disallows space after obfunction(key) { var colon = file.getNextToken(key); var spaces = Math.abs(colon.range[0] - key.range[1]); if (spaces === 0) { withoutSpace++; } else if (spaces === maxKeyEndPos - key.loc.end.column) { alignedOnColon++; } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space after object ke{ withoutSpace++; } else if (spaces === maxKeyEndPos - key.loc.end.column) { |
| ✓ Negative was executed (else) | /**··· * Disallows space afteif (spaces === maxKeyEndPos - key.loc.end.column) { alignedOnColon++; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space after object keys. * * Types: `Boolean` or `String` { alignedOnColon++; } |
| ✓ Negative was executed (else) | /**··· * Disallows spac }); |
| Function (anonymous_554) | |
|---|---|
| ✓ Was called | /**··· * Disallows space aftefunction(key) { var colon = file.getNextToken(key); var spaces = (exceptAligned && !noSpace) ? maxKeyEndPos - key.loc.end.column : 0; errors.assert.spacesBetween({ token: key, nextToken: colon, exactly: spaces, message: 'Illegal space after key', disallowNewLine: true }); }); |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | /**··· * Disallows space after object keys. * * Types: `BoomaxKeyEndPos - key.loc.end.column : 0; |
| ✓ Negative was returned (: ...) | /**··· * Disallows space after object keys. * * Types: `Boolean` or `String` * * Values: * 0; |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows space after object keys. * *!noSpace) ? maxKeyEndPos - key.loc.end.column : 0; |
| ✓ Was returned | /**··· * Disallows space after oexceptAligned && !noSpace) ? maxKeyEndPos - key.loc.end.column : 0; |
| Function (anonymous_555) | |
|---|---|
| ✓ Was called | /**··· * Requires sfunction() {}; |
| Function (anonymous_556) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(operators) { var isTrue = operators === true; assert( Array.isArray(operators) || isTrue, this.getOptionName() + ' option requires array or true value' ); if (isTrue) { operators = defaultOperators; } this._operatorIndex = {}; for (var i = 0, l = operators.length; i < l; i++) { this._operatorIndex[operators[i]] = true; } }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires sticking unary operatorsisTrue, |
| ✓ Was returned | /**··· * RequiArray.isArray(operators) || isTrue, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires stic{ operators = defaultOperators; } |
| ✓ Negative was executed (else) | /**··· * Re this._operatorIndex = {}; |
| Function (anonymous_557) | |
|---|---|
| ✓ Was called | /**··· * Requires stifunction() { return 'disallowSpaceAfterPrefixUnaryOperators'; }, |
| Function (anonymous_558) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var operatorIndex = this._operatorIndex; file.iterateNodesByType(['UnaryExpression', 'UpdateExpression'], function(node) { // Check "node.prefix" for prefix type of (inc|dec)rement if (node.prefix && operatorIndex[node.operator]) { var operatorToken = file.getFirstNodeToken(node); errors.assert.noWhitespaceBetween({ token: operatorToken, nextToken: file.getNextToken(operatorToken), message: 'Operator ' + node.operator + ' should stick to operand' }); } }); } |
| Function (anonymous_559) | |
|---|---|
| ✓ Was called | /**··· * Requires sticking unary operators to the right. * * Types: `Arrafunction(node) { // Check "node.prefix" for prefix type of (inc|dec)rement if (node.prefix && operatorIndex[node.operator]) { var operatorToken = file.getFirstNodeToken(node); errors.assert.noWhitespaceBetween({ token: operatorToken, nextToken: file.getNextToken(operatorToken), message: 'Operator ' + node.operator + ' should stick to operand' }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires sticking unary operators to the right. * * { var operatorToken = file.getFirstNodeToken(node); errors.assert.noWhitespaceBetween({ token: operatorToken, nextToken: file.getNextToken(operatorToken), message: 'Operator ' + node.operator + ' should stick to operand' }); } |
| ✓ Negative was executed (else) | /**··· * Requir }); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires sticking unary operatorIndex[node.operator]) { |
| ✓ Was returned | /**··· * Requires node.prefix && operatorIndex[node.operator]) { |
| Function (anonymous_560) | |
|---|---|
| ✓ Was called | /**··· * Requires sfunction() {}; |
| Function (anonymous_561) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(operators) { var isTrue = operators === true; assert( Array.isArray(operators) || isTrue, this.getOptionName() + ' option requires array or true value' ); if (isTrue) { operators = allOperators; } this._operatorIndex = {}; for (var i = 0, l = operators.length; i < l; i++) { this._operatorIndex[operators[i]] = true; } }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires sticking binary operatorisTrue, |
| ✓ Was returned | /**··· * RequiArray.isArray(operators) || isTrue, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires stic{ operators = allOperators; } |
| ✓ Negative was executed (else) | /**··· * Re this._operatorIndex = {}; |
| Function (anonymous_562) | |
|---|---|
| ✓ Was called | /**··· * Requires stifunction() { return 'disallowSpaceBeforeBinaryOperators'; }, |
| Function (anonymous_563) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var operators = this._operatorIndex; // Comma if (operators[',']) { file.iterateTokensByTypeAndValue('Punctuator', ',', function(token) { if (file.getPrevToken(token).value === ',') { return; } errors.assert.noWhitespaceBetween({ token: file.getPrevToken(token, {includeComments: true}), nextToken: token, message: 'Operator , should stick to previous expression' }); }); } // For everything else file.iterateNodesByType( ['BinaryExpression', 'AssignmentExpression', 'VariableDeclarator', 'LogicalExpression'], function(node) { var operator; var expression; if (node.type === 'VariableDeclarator') { expression = node.init; operator = '='; } else { operator = node.operator; expression = node.right; } if (expression === null) { return; } var operatorToken = file.findPrevOperatorToken( file.getFirstNodeToken(expression), operator ); var prevToken = file.getPrevToken(operatorToken, {includeComments: true}); if (operators[operator]) { errors.assert.noWhitespaceBetween({ token: prevToken, nextToken: operatorToken, message: 'Operator ' + node.operator + ' should stick to previous expression' }); } } ); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires sticking bin{ file.iterateTokensByTypeAndValue('Punctuator', ',', function(token) { if (file.getPrevToken(token).value === ',') { return; } errors.assert.noWhitespaceBetween({ token: file.getPrevToken(token, {includeComments: true}), nextToken: token, message: 'Operator , should stick to previous expression' }); }); } |
| ✓ Negative was executed (else) | /**··· * Re // For everything else |
| Function (anonymous_564) | |
|---|---|
| ✓ Was called | /**··· * Requires sticking binary operators to the left. * * Typfunction(token) { if (file.getPrevToken(token).value === ',') { return; } errors.assert.noWhitespaceBetween({ token: file.getPrevToken(token, {includeComments: true}), nextToken: token, message: 'Operator , should stick to previous expression' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires sticking binary operators to the left. * *{ return; } |
| ✓ Negative was executed (else) | /**··· * Requires s errors.assert.noWhitespaceBetween({ |
| Function (anonymous_565) | |
|---|---|
| ✓ Was called | /**··· * Requifunction(node) { var operator; var expression; if (node.type === 'VariableDeclarator') { expression = node.init; operator = '='; } else { operator = node.operator; expression = node.right; } if (expression === null) { return; } var operatorToken = file.findPrevOperatorToken( file.getFirstNodeToken(expression), operator ); var prevToken = file.getPrevToken(operatorToken, {includeComments: true}); if (operators[operator]) { errors.assert.noWhitespaceBetween({ token: prevToken, nextToken: operatorToken, message: 'Operator ' + node.operator + ' should stick to previous expression' }); } } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires sticking binary operators to the left. { expression = node.init; operator = '='; } else { |
| ✓ Negative was executed (else) | /**··· * Requires stickin{ operator = node.operator; expression = node.right; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires sticking binary operators{ return; } |
| ✓ Negative was executed (else) | /**··· * Requires s var operatorToken = file.findPrevOperatorToken( |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires sticking binary operators{ errors.assert.noWhitespaceBetween({ token: prevToken, nextToken: operatorToken, message: 'Operator ' + node.operator + ' should stick to previous expression' }); } |
| ✓ Negative was executed (else) | /**··· * Requires s } |
| Function (anonymous_566) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_567) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(options) { assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_568) | |
|---|---|
| ✓ Was called | /**··· * Disallows spfunction() { return 'disallowSpaceBeforeBlockStatements'; }, |
| Function (anonymous_569) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { file.iterateNodesByType('BlockStatement', function(node) { if (isBareBlock(node)) { return; } var first = file.getFirstNodeToken(node); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(first), nextToken: first, disallowNewLine: true, message: 'Extra space before opening curly brace for block expressions' }); }); } |
| Function (anonymous_570) | |
|---|---|
| ✓ Was called | /**··· * Disallows space before block statements (fofunction(node) { if (isBareBlock(node)) { return; } var first = file.getFirstNodeToken(node); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(first), nextToken: first, disallowNewLine: true, message: 'Extra space before opening curly brace for block expressions' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space before block{ return; } |
| ✓ Negative was executed (else) | /**··· * Disall var first = file.getFirstNodeToken(node); |
| Function isBareBlock | |
|---|---|
| ✓ Was called | function isBareBlock(node) {··· var parentNode = node.parentNode; return parentNode && parentNode.type === 'BlockStatement' || parentNode.type === 'Program' || parentNode.body && parentNode.body.type === 'BlockStatement' && Array.isArray(parentNode.body); } |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· parentNode.body && parentNode.body.type === 'BlockStatement' && Array.isArray(parentNode.body); |
| ✓ Was returned | /**··· * DisaparentNode && parentNode.type === 'BlockStatement' || parentNode.type === 'Program' || |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· parentNode.type === 'Program' || |
| ✓ Was returned | /**··· * DisaparentNode && parentNode.type === 'BlockStatement' || |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· parentNode.type === 'BlockStatement' || |
| ✗ Was not returned | /**··· * DisaparentNode && |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disallows space before block statements (for loops, control sArray.isArray(parentNode.body); |
| ✓ Was returned | /**··· parentNode.body && parentNode.body.type === 'BlockStatement' && Array.isArray(parentNode.body); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows space parentNode.body.type === 'BlockStatement' && Array.isArray(parentNode.body); |
| ✓ Was returned | /**··· parentNode.body && parentNode.body.type === 'BlockStatement' && Array.isArray(parentNode.body); |
| Function (anonymous_572) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() { }; |
| Function (anonymous_573) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(options) { if (typeof options !== 'object') { assert( options === true, this.getOptionName() + ' option requires true value or an object' ); var _options = {allExcept: []}; return this.configure(_options); } assert( Array.isArray(options.allExcept), ' property `allExcept` in ' + this.getOptionName() + ' should be an array of strings' ); this._exceptSparseArrays = options.allExcept.indexOf('sparseArrays') >= 0; }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows spaces before commas * { assert( options === true, this.getOptionName() + ' option requires true value or an object' ); var _options = {allExcept: []}; return this.configure(_options); } |
| ✓ Negative was executed (else) | /**··· * Di assert( |
| Function (anonymous_574) | |
|---|---|
| ✓ Was called | /**··· * Disallows spfunction() { return 'disallowSpaceBeforeComma'; }, |
| Function (anonymous_575) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { var exceptSparseArrays = this._exceptSparseArrays; file.iterateTokensByTypeAndValue('Punctuator', ',', function(token) { var prevToken = file.getPrevToken(token); if (exceptSparseArrays && prevToken.value === ',') { return; } errors.assert.noWhitespaceBetween({ token: prevToken, nextToken: token, message: 'Illegal space before comma' }); }); } |
| Function (anonymous_576) | |
|---|---|
| ✓ Was called | /**··· * Disallows spaces before commas * * Types: `Boolean`function(token) { var prevToken = file.getPrevToken(token); if (exceptSparseArrays && prevToken.value === ',') { return; } errors.assert.noWhitespaceBetween({ token: prevToken, nextToken: token, message: 'Illegal space before comma' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows spaces before commas * * Types: `Boolean` or{ return; } |
| ✓ Negative was executed (else) | /**··· * Disall errors.assert.noWhitespaceBetween({ |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows spaces before commas prevToken.value === ',') { |
| ✓ Was returned | /**··· * DisallowsexceptSparseArrays && prevToken.value === ',') { |
| Function (anonymous_577) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_578) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(keywords) { assert( Array.isArray(keywords) || keywords === true, this.getOptionName() + ' option requires array or true value'); if (keywords === true) { keywords = defaultKeywords; } this._keywords = keywords; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disallows space before keyword. keywords === true, |
| ✓ Was returned | /**··· * DisalArray.isArray(keywords) || keywords === true, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space before k{ keywords = defaultKeywords; } |
| ✓ Negative was executed (else) | /**··· * Di this._keywords = keywords; |
| Function (anonymous_579) | |
|---|---|
| ✓ Was called | /**··· * Disallows spfunction() { return 'disallowSpaceBeforeKeywords'; }, |
| Function (anonymous_580) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { file.iterateTokensByTypeAndValue('Keyword', this._keywords, function(token) { var prevToken = file.getPrevToken(token, {includeComments: true}); if (!prevToken || prevToken.isComment) { return; } if (prevToken.type !== 'Keyword' && prevToken.value !== ';') { errors.assert.noWhitespaceBetween({ token: prevToken, nextToken: token, message: 'Illegal space before "' + token.value + '" keyword' }); } }); } |
| Function (anonymous_581) | |
|---|---|
| ✓ Was called | /**··· * Disallows space before keyword. * * Types: `Array` or `Boolfunction(token) { var prevToken = file.getPrevToken(token, {includeComments: true}); if (!prevToken || prevToken.isComment) { return; } if (prevToken.type !== 'Keyword' && prevToken.value !== ';') { errors.assert.noWhitespaceBetween({ token: prevToken, nextToken: token, message: 'Illegal space before "' + token.value + '" keyword' }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space before keyword. * * Types:{ return; } |
| ✓ Negative was executed (else) | /**··· * Disall if (prevToken.type !== 'Keyword' && prevToken.value !== ';') { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows space before prevToken.isComment) { |
| ✓ Was returned | /**··· * Disallows!prevToken || prevToken.isComment) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space before keyword. * * Types: `Array` or `Boolean` { errors.assert.noWhitespaceBetween({ token: prevToken, nextToken: token, message: 'Illegal space before "' + token.value + '" keyword' }); } |
| ✓ Negative was executed (else) | /**··· * Disall }); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows space before keyword. * * TypprevToken.value !== ';') { |
| ✓ Was returned | /**··· * DisallowsprevToken.type !== 'Keyword' && prevToken.value !== ';') { |
| Function (anonymous_582) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_583) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(disallow) { assert( disallow === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_584) | |
|---|---|
| ✓ Was called | /**··· * Disallows spfunction() { return 'disallowSpaceBeforeObjectValues'; }, |
| Function (anonymous_585) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { file.iterateNodesByType('ObjectExpression', function(node) { node.properties.forEach(function(property) { if (property.shorthand || property.method || property.kind !== 'init' || node.type === 'SpreadProperty') { return; } var keyToken = file.getFirstNodeToken(property.key); var colon = file.findNextToken(keyToken, 'Punctuator', ':'); errors.assert.noWhitespaceBetween({ token: colon, nextToken: file.getNextToken(colon), message: 'Illegal space after key colon' }); }); }); } |
| Function (anonymous_586) | |
|---|---|
| ✓ Was called | /**··· * Disallows space before object values. * * Tfunction(node) { node.properties.forEach(function(property) { if (property.shorthand || property.method || property.kind !== 'init' || node.type === 'SpreadProperty') { return; } var keyToken = file.getFirstNodeToken(property.key); var colon = file.findNextToken(keyToken, 'Punctuator', ':'); errors.assert.noWhitespaceBetween({ token: colon, nextToken: file.getNextToken(colon), message: 'Illegal space after key colon' }); }); }); |
| Function (anonymous_587) | |
|---|---|
| ✓ Was called | /**··· * Disallows space before objectfunction(property) { if (property.shorthand || property.method || property.kind !== 'init' || node.type === 'SpreadProperty') { return; } var keyToken = file.getFirstNodeToken(property.key); var colon = file.findNextToken(keyToken, 'Punctuator', ':'); errors.assert.noWhitespaceBetween({ token: colon, nextToken: file.getNextToken(colon), message: 'Illegal space after key colon' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space before object values. * * T{ return; } |
| ✓ Negative was executed (else) | /**··· * Disallows var keyToken = file.getFirstNodeToken(property.key); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows spanode.type === 'SpreadProperty') { |
| ✓ Was returned | /**··· * Disallows spaproperty.shorthand || property.method || property.kind !== 'init' || |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows space before object values. * * Type: `Booproperty.kind !== 'init' || |
| ✓ Was returned | /**··· * Disallows spaproperty.shorthand || property.method || property.kind !== 'init' || |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows space before object valueproperty.method || property.kind !== 'init' || |
| ✓ Was returned | /**··· * Disallows spaproperty.shorthand || property.method || property.kind !== 'init' || |
| Function (anonymous_588) | |
|---|---|
| ✓ Was called | /**··· * Requires sfunction() {}; |
| Function (anonymous_589) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(operators) { var isTrue = operators === true; assert( Array.isArray(operators) || isTrue, this.getOptionName() + ' option requires array or true value' ); if (isTrue) { operators = defaultOperators; } this._operatorIndex = {}; for (var i = 0, l = operators.length; i < l; i++) { this._operatorIndex[operators[i]] = true; } }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires sticking unary operatorsisTrue, |
| ✓ Was returned | /**··· * RequiArray.isArray(operators) || isTrue, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires stic{ operators = defaultOperators; } |
| ✓ Negative was executed (else) | /**··· * Re this._operatorIndex = {}; |
| Function (anonymous_590) | |
|---|---|
| ✓ Was called | /**··· * Requires stifunction() { return 'disallowSpaceBeforePostfixUnaryOperators'; }, |
| Function (anonymous_591) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var operatorIndex = this._operatorIndex; // 'UpdateExpression' involve only ++ and -- operators file.iterateNodesByType('UpdateExpression', function(node) { // "!node.prefix" means postfix type of (inc|dec)rement if (!node.prefix && operatorIndex[node.operator]) { var operatorToken = file.getLastNodeToken(node); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(operatorToken), nextToken: operatorToken, message: 'Operator ' + node.operator + ' should stick to operand' }); } }); } |
| Function (anonymous_592) | |
|---|---|
| ✓ Was called | /**··· * Requires sticking unary operators to the leftfunction(node) { // "!node.prefix" means postfix type of (inc|dec)rement if (!node.prefix && operatorIndex[node.operator]) { var operatorToken = file.getLastNodeToken(node); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(operatorToken), nextToken: operatorToken, message: 'Operator ' + node.operator + ' should stick to operand' }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires sticking unary operators to the left. * * Ty{ var operatorToken = file.getLastNodeToken(node); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(operatorToken), nextToken: operatorToken, message: 'Operator ' + node.operator + ' should stick to operand' }); } |
| ✓ Negative was executed (else) | /**··· * Requir }); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires sticking unary ooperatorIndex[node.operator]) { |
| ✓ Was returned | /**··· * Requires !node.prefix && operatorIndex[node.operator]) { |
| Function (anonymous_593) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_594) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(value) { var isObject = typeof value === 'object'; var error = this.getOptionName() + ' rule requires string value true or object'; if (isObject) { assert('allExcept' in value, error); } else { assert(value === true, error); } this._exceptions = {}; if (isObject) { (value.allExcept || []).forEach(function(value) { this._exceptions[value] = true; }, this); } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space{ assert('allExcept' in value, error); } else { |
| ✓ Negative was executed (else) | /**··· * Disallow{ assert(value === true, error); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space{ (value.allExcept || []).forEach(function(value) { this._exceptions[value] = true; }, this); } |
| ✓ Negative was executed (else) | /**··· * Di }, |
| Function (anonymous_595) | |
|---|---|
| ✓ Was called | /**··· * Disallows spaces before semicolons. function(value) { this._exceptions[value] = true; }, this); |
| Branch LogicalExpression | |
| ✗ Was not returned | /**··· * Disallows spaces before s[]).forEach(function(value) { |
| ✓ Was returned | /**··· * Disallvalue.allExcept || []).forEach(function(value) { |
| Function (anonymous_596) | |
|---|---|
| ✓ Was called | /**··· * Disallows spfunction() { return 'disallowSpaceBeforeSemicolon'; }, |
| Function (anonymous_597) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { var exceptions = this._exceptions; file.iterateTokensByTypeAndValue('Punctuator', ';', function(token) { var prevToken = file.getPrevToken(token); if (!prevToken || prevToken.value in exceptions) { return; } errors.assert.noWhitespaceBetween({ token: prevToken, nextToken: token, message: 'Illegal space before semicolon' }); }); } |
| Function (anonymous_598) | |
|---|---|
| ✓ Was called | /**··· * Disallows spaces before semicolons. * * Types: `Boofunction(token) { var prevToken = file.getPrevToken(token); if (!prevToken || prevToken.value in exceptions) { return; } errors.assert.noWhitespaceBetween({ token: prevToken, nextToken: token, message: 'Illegal space before semicolon' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows spaces before semicolons. * * Types: `Bool{ return; } |
| ✓ Negative was executed (else) | /**··· * Disall errors.assert.noWhitespaceBetween({ |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows spaces beforeprevToken.value in exceptions) { |
| ✓ Was returned | /**··· * Disallows!prevToken || prevToken.value in exceptions) { |
| Function (anonymous_599) | |
|---|---|
| ✓ Was called | /**··· * Ensure thefunction() {}; |
| Function (anonymous_600) | |
|---|---|
| ✓ Was called | /**··· * Ensure tfunction(options) { assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_601) | |
|---|---|
| ✓ Was called | /**··· * Ensure therefunction() { return 'disallowSpaceBetweenArguments'; }, |
| Function (anonymous_602) | |
|---|---|
| ✓ Was called | /**··· * Ensufunction(file, errors) { file.iterateNodesByType(['CallExpression'], function(node) { node.arguments.forEach(function(param) { var token = file.getFirstNodeToken(param); var punctuatorToken = file.getPrevToken(token); if (punctuatorToken.value === ',') { errors.assert.noWhitespaceBetween({ token: punctuatorToken, nextToken: file.getNextToken(punctuatorToken), message: 'Illegal space between arguments' }); } }); }); } |
| Function (anonymous_603) | |
|---|---|
| ✓ Was called | /**··· * Ensure there are no spaces after argument sepfunction(node) { node.arguments.forEach(function(param) { var token = file.getFirstNodeToken(param); var punctuatorToken = file.getPrevToken(token); if (punctuatorToken.value === ',') { errors.assert.noWhitespaceBetween({ token: punctuatorToken, nextToken: file.getNextToken(punctuatorToken), message: 'Illegal space between arguments' }); } }); }); |
| Function (anonymous_604) | |
|---|---|
| ✓ Was called | /**··· * Ensure there are no spaces afunction(param) { var token = file.getFirstNodeToken(param); var punctuatorToken = file.getPrevToken(token); if (punctuatorToken.value === ',') { errors.assert.noWhitespaceBetween({ token: punctuatorToken, nextToken: file.getNextToken(punctuatorToken), message: 'Illegal space between arguments' }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Ensure there are no spaces after argument se{ errors.assert.noWhitespaceBetween({ token: punctuatorToken, nextToken: file.getNextToken(punctuatorToken), message: 'Illegal space between arguments' }); } |
| ✓ Negative was executed (else) | /**··· * Ensure the }); |
| Function (anonymous_605) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_606) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(options) { assert( typeof options === 'object', this.getOptionName() + ' option must be the object' ); if ('beforeOpeningRoundBrace' in options) { assert( options.beforeOpeningRoundBrace === true, this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } if ('beforeOpeningCurlyBrace' in options) { assert( options.beforeOpeningCurlyBrace === true, this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } assert( options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, this.getOptionName() + ' must have beforeOpeningCurlyBrace ' + ' or beforeOpeningRoundBrace property' ); this._beforeOpeningRoundBrace = Boolean(options.beforeOpeningRoundBrace); this._beforeOpeningCurlyBrace = Boolean(options.beforeOpeningCurlyBrace); }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space before `()` or `{}` in anon{ assert( options.beforeOpeningRoundBrace === true, this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | /**··· * Di if ('beforeOpeningCurlyBrace' in options) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space before `()` or `{}` in anon{ assert( options.beforeOpeningCurlyBrace === true, this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | /**··· * Di assert( |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disallows space before `()` or `{}` in aoptions.beforeOpeningRoundBrace, |
| ✓ Was returned | /**··· * Disaloptions.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, |
| Function (anonymous_607) | |
|---|---|
| ✓ Was called | /**··· * Disallows spfunction() { return 'disallowSpacesInAnonymousFunctionExpression'; }, |
| Function (anonymous_608) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { var beforeOpeningRoundBrace = this._beforeOpeningRoundBrace; var beforeOpeningCurlyBrace = this._beforeOpeningCurlyBrace; file.iterateNodesByType(['FunctionExpression'], function(node) { var functionNode = node; var parent = node.parentNode; // Ignore syntactic sugar for getters and setters. if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { return; } // shorthand or constructor methods if (parent.method || parent.type === 'MethodDefinition') { functionNode = parent.key; } // anonymous function expressions only if (node.id) { return; } if (beforeOpeningRoundBrace) { var functionToken = file.getFirstNodeToken(functionNode); if (node.async && functionToken.value === 'async') { functionToken = file.getNextToken(functionToken); } // if generator, set token to be * instead if (node.generator && functionToken.value === 'function') { functionToken = file.getNextToken(functionToken); } errors.assert.noWhitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Illegal space before opening round brace' }); } if (beforeOpeningCurlyBrace) { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Illegal space before opening curly brace' }); } }); } |
| Function (anonymous_609) | |
|---|---|
| ✓ Was called | /**··· * Disallows space before `()` or `{}` in anonymous function(node) { var functionNode = node; var parent = node.parentNode; // Ignore syntactic sugar for getters and setters. if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { return; } // shorthand or constructor methods if (parent.method || parent.type === 'MethodDefinition') { functionNode = parent.key; } // anonymous function expressions only if (node.id) { return; } if (beforeOpeningRoundBrace) { var functionToken = file.getFirstNodeToken(functionNode); if (node.async && functionToken.value === 'async') { functionToken = file.getNextToken(functionToken); } // if generator, set token to be * instead if (node.generator && functionToken.value === 'function') { functionToken = file.getNextToken(functionToken); } errors.assert.noWhitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Illegal space before opening round brace' }); } if (beforeOpeningCurlyBrace) { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Illegal space before opening curly brace' }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space before `()` or `{}` in anonymous function expressions. * * Type: `Objec{ return; } |
| ✓ Negative was executed (else) | /**··· * Disall // shorthand or constructor methods |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows space before `()` or `{}` in aparent.kind === 'get' || parent.kind === 'set')) { |
| ✓ Was returned | /**··· * Disallowsparent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows space before `()` or `{}` in anonymous function expressparent.kind === 'set')) { |
| ✓ Was returned | /**··· * Disallows space before `()` or `{}` in aparent.kind === 'get' || parent.kind === 'set')) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space before `()` or `{}` in anonymous function expr{ functionNode = parent.key; } |
| ✓ Negative was executed (else) | /**··· * Disall // anonymous function expressions only |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows space before `()parent.type === 'MethodDefinition') { |
| ✓ Was returned | /**··· * Disallowsparent.method || parent.type === 'MethodDefinition') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space be{ return; } |
| ✓ Negative was executed (else) | /**··· * Disall if (beforeOpeningRoundBrace) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space before `()` or `{}{ var functionToken = file.getFirstNodeToken(functionNode); if (node.async && functionToken.value === 'async') { functionToken = file.getNextToken(functionToken); } // if generator, set token to be * instead if (node.generator && functionToken.value === 'function') { functionToken = file.getNextToken(functionToken); } errors.assert.noWhitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Illegal space before opening round brace' }); } |
| ✓ Negative was executed (else) | /**··· * Disall if (beforeOpeningCurlyBrace) { |
| Branch IfStatement | |
|---|---|
| ✗ Positive was not executed (if) | /**··· * Disallows space before `()` or `{}` in anonymous function ex{ functionToken = file.getNextToken(functionToken); } |
| ✓ Negative was executed (else) | /**··· * Disallows // if generator, set token to be * instead |
| Branch LogicalExpression | |
| ✗ Was not returned | /**··· * Disallows space before `()`functionToken.value === 'async') { |
| ✓ Was returned | /**··· * Disallows spanode.async && functionToken.value === 'async') { |
| Branch IfStatement | |
|---|---|
| ✗ Positive was not executed (if) | /**··· * Disallows space before `()` or `{}` in anonymous function expressio{ functionToken = file.getNextToken(functionToken); } |
| ✓ Negative was executed (else) | /**··· * Disallows errors.assert.noWhitespaceBetween({ |
| Branch LogicalExpression | |
| ✗ Was not returned | /**··· * Disallows space before `()` or functionToken.value === 'function') { |
| ✓ Was returned | /**··· * Disallows spanode.generator && functionToken.value === 'function') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space before `()` or `{}{ var bodyToken = file.getFirstNodeToken(node.body); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Illegal space before opening curly brace' }); } |
| ✓ Negative was executed (else) | /**··· * Disall }); |
| Function (anonymous_610) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_611) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(options) { assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_612) | |
|---|---|
| ✓ Was called | /**··· * Disallows spfunction() { return 'disallowSpacesInCallExpression'; }, |
| Function (anonymous_613) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { file.iterateNodesByType(['CallExpression', 'NewExpression'], function(node) { function doesTokenBelongToNode(token, node) { return token.range[1] <= node.range[1]; } var lastCalleeToken = file.getLastNodeToken(node.callee); var roundBraceToken = file.findNextToken(lastCalleeToken, 'Punctuator', '('); // CallExpressions can't have missing parens, otherwise they're identifiers if (node.type === 'NewExpression') { if (roundBraceToken === null || !doesTokenBelongToNode(roundBraceToken, node)) { return; } } errors.assert.noWhitespaceBetween({ token: file.getPrevToken(roundBraceToken), nextToken: roundBraceToken, message: 'Illegal space before opening round brace' }); }); } |
| Function (anonymous_614) | |
|---|---|
| ✓ Was called | /**··· * Disallows space before `()` in call expressions. * * Type: `function(node) { function doesTokenBelongToNode(token, node) { return token.range[1] <= node.range[1]; } var lastCalleeToken = file.getLastNodeToken(node.callee); var roundBraceToken = file.findNextToken(lastCalleeToken, 'Punctuator', '('); // CallExpressions can't have missing parens, otherwise they're identifiers if (node.type === 'NewExpression') { if (roundBraceToken === null || !doesTokenBelongToNode(roundBraceToken, node)) { return; } } errors.assert.noWhitespaceBetween({ token: file.getPrevToken(roundBraceToken), nextToken: roundBraceToken, message: 'Illegal space before opening round brace' }); }); |
| Function doesTokenBelongToNode | |
|---|---|
| ✓ Was called | /**··· * Disalfunction doesTokenBelongToNode(token, node) { return token.range[1] <= node.range[1]; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space before `()` in call expr{ if (roundBraceToken === null || !doesTokenBelongToNode(roundBraceToken, node)) { return; } } |
| ✓ Negative was executed (else) | /**··· * Disall errors.assert.noWhitespaceBetween({ |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space before `()` in call expressions. * * Type: `Boolean` * * Value: `tru{ return; } |
| ✓ Negative was executed (else) | /**··· * Disallows } |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows space before `()` in call expre!doesTokenBelongToNode(roundBraceToken, node)) { |
| ✓ Was returned | /**··· * Disallows sparoundBraceToken === null || !doesTokenBelongToNode(roundBraceToken, node)) { |
| Function (anonymous_616) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_617) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(options) { var validProperties = [ 'afterTest', 'beforeConsequent', 'afterConsequent', 'beforeAlternate' ]; var optionName = this.getOptionName(); if (options === true) { options = { 'afterTest': true, 'beforeConsequent': true, 'afterConsequent': true, 'beforeAlternate': true }; } assert( typeof options === 'object', optionName + ' option requires a true value or an object' ); var isProperlyConfigured = validProperties.some(function(key) { var isPresent = key in options; if (isPresent) { assert( options[key] === true, optionName + '.' + key + ' property requires true value or should be removed' ); } return isPresent; }); assert( isProperlyConfigured, optionName + ' must have at least 1 of the following properties: ' + validProperties.join(', ') ); validProperties.forEach(function(property) { this['_' + property] = Boolean(options[property]); }.bind(this)); }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space before { options = { 'afterTest': true, 'beforeConsequent': true, 'afterConsequent': true, 'beforeAlternate': true }; } |
| ✓ Negative was executed (else) | /**··· * Di assert( |
| Function (anonymous_618) | |
|---|---|
| ✓ Was called | /**··· * Disallows space before and/or after `?` or `:` infunction(key) { var isPresent = key in options; if (isPresent) { assert( options[key] === true, optionName + '.' + key + ' property requires true value or should be removed' ); } return isPresent; }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space befo{ assert( options[key] === true, optionName + '.' + key + ' property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | /**··· * Disall return isPresent; |
| Function (anonymous_619) | |
|---|---|
| ✓ Was called | /**··· * Disallows space before anfunction(property) { this['_' + property] = Boolean(options[property]); }.bind(this)); |
| Function (anonymous_620) | |
|---|---|
| ✓ Was called | /**··· * Disallows spfunction() { return 'disallowSpacesInConditionalExpression'; }, |
| Function (anonymous_621) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { file.iterateNodesByType(['ConditionalExpression'], function(node) { var test = node.test; var consequent = node.consequent; var consequentToken = file.getFirstNodeToken(consequent); var alternate = node.alternate; var alternateToken = file.getFirstNodeToken(alternate); var questionMarkToken = file.findPrevOperatorToken(consequentToken, '?'); var colonToken = file.findPrevOperatorToken(alternateToken, ':'); var token; if (this._afterTest && test.loc.end.line === questionMarkToken.loc.start.line) { token = file.getPrevToken(questionMarkToken); errors.assert.noWhitespaceBetween({ token: token, nextToken: questionMarkToken, message: 'Illegal space after test' }); } if (this._beforeConsequent && consequent.loc.end.line === questionMarkToken.loc.start.line) { token = file.getNextToken(questionMarkToken); errors.assert.noWhitespaceBetween({ token: questionMarkToken, nextToken: token, message: 'Illegal space before consequent' }); } if (this._afterConsequent && consequent.loc.end.line === colonToken.loc.start.line) { token = file.getPrevToken(colonToken); errors.assert.noWhitespaceBetween({ token: token, nextToken: colonToken, message: 'Illegal space after consequent' }); } if (this._beforeAlternate && alternate.loc.end.line === colonToken.loc.start.line) { token = file.getNextToken(colonToken); errors.assert.noWhitespaceBetween({ token: colonToken, nextToken: token, message: 'Illegal space before alternate' }); } }.bind(this)); } |
| Function (anonymous_622) | |
|---|---|
| ✓ Was called | /**··· * Disallows space before and/or after `?` or `:` in cofunction(node) { var test = node.test; var consequent = node.consequent; var consequentToken = file.getFirstNodeToken(consequent); var alternate = node.alternate; var alternateToken = file.getFirstNodeToken(alternate); var questionMarkToken = file.findPrevOperatorToken(consequentToken, '?'); var colonToken = file.findPrevOperatorToken(alternateToken, ':'); var token; if (this._afterTest && test.loc.end.line === questionMarkToken.loc.start.line) { token = file.getPrevToken(questionMarkToken); errors.assert.noWhitespaceBetween({ token: token, nextToken: questionMarkToken, message: 'Illegal space after test' }); } if (this._beforeConsequent && consequent.loc.end.line === questionMarkToken.loc.start.line) { token = file.getNextToken(questionMarkToken); errors.assert.noWhitespaceBetween({ token: questionMarkToken, nextToken: token, message: 'Illegal space before consequent' }); } if (this._afterConsequent && consequent.loc.end.line === colonToken.loc.start.line) { token = file.getPrevToken(colonToken); errors.assert.noWhitespaceBetween({ token: token, nextToken: colonToken, message: 'Illegal space after consequent' }); } if (this._beforeAlternate && alternate.loc.end.line === colonToken.loc.start.line) { token = file.getNextToken(colonToken); errors.assert.noWhitespaceBetween({ token: colonToken, nextToken: token, message: 'Illegal space before alternate' }); } }.bind(this)); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space before and/or after `?` or `:` in conditional expressions. * * Typ{ token = file.getPrevToken(questionMarkToken); errors.assert.noWhitespaceBetween({ token: token, nextToken: questionMarkToken, message: 'Illegal space after test' }); } |
| ✓ Negative was executed (else) | /**··· * Disall if (this._beforeConsequent && consequent.loc.end.line === questionMarkToken.loc.start.line) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows space before and/otest.loc.end.line === questionMarkToken.loc.start.line) { |
| ✓ Was returned | /**··· * Disallowsthis._afterTest && test.loc.end.line === questionMarkToken.loc.start.line) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space before and/or after `?` or `:` in conditional expressions. * * Types: `Object` { token = file.getNextToken(questionMarkToken); errors.assert.noWhitespaceBetween({ token: questionMarkToken, nextToken: token, message: 'Illegal space before consequent' }); } |
| ✓ Negative was executed (else) | /**··· * Disall if (this._afterConsequent && consequent.loc.end.line === colonToken.loc.start.line) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows space before and/or afterconsequent.loc.end.line === questionMarkToken.loc.start.line) { |
| ✓ Was returned | /**··· * Disallowsthis._beforeConsequent && consequent.loc.end.line === questionMarkToken.loc.start.line) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space before and/or after `?` or `:` in conditional expressions. * * Types: `{ token = file.getPrevToken(colonToken); errors.assert.noWhitespaceBetween({ token: token, nextToken: colonToken, message: 'Illegal space after consequent' }); } |
| ✓ Negative was executed (else) | /**··· * Disall if (this._beforeAlternate && alternate.loc.end.line === colonToken.loc.start.line) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows space before and/or afteconsequent.loc.end.line === colonToken.loc.start.line) { |
| ✓ Was returned | /**··· * Disallowsthis._afterConsequent && consequent.loc.end.line === colonToken.loc.start.line) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space before and/or after `?` or `:` in conditional expressions. * * Types: { token = file.getNextToken(colonToken); errors.assert.noWhitespaceBetween({ token: colonToken, nextToken: token, message: 'Illegal space before alternate' }); } |
| ✓ Negative was executed (else) | /**··· * Disall }.bind(this)); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows space before and/or aftealternate.loc.end.line === colonToken.loc.start.line) { |
| ✓ Was returned | /**··· * Disallowsthis._beforeAlternate && alternate.loc.end.line === colonToken.loc.start.line) { |
| Function (anonymous_623) | |
|---|---|
| ✓ Was called | /**··· * Disallow sfunction() {}; |
| Function (anonymous_624) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(options) { assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_625) | |
|---|---|
| ✓ Was called | /**··· * Disallow spafunction() { return 'disallowSpacesInForStatement'; }, |
| Function (anonymous_626) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { file.iterateNodesByType('ForStatement', function(node) { if (node.test) { var testToken = file.getFirstNodeToken(node.test); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(testToken), nextToken: testToken, message: 'Space found after semicolon' }); } if (node.update) { var updateToken = file.getFirstNodeToken(node.update); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(updateToken), nextToken: updateToken, message: 'Space found after semicolon' }); } }); } |
| Function (anonymous_627) | |
|---|---|
| ✓ Was called | /**··· * Disallow spaces in between for statement.function(node) { if (node.test) { var testToken = file.getFirstNodeToken(node.test); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(testToken), nextToken: testToken, message: 'Space found after semicolon' }); } if (node.update) { var updateToken = file.getFirstNodeToken(node.update); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(updateToken), nextToken: updateToken, message: 'Space found after semicolon' }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallow spaces in b{ var testToken = file.getFirstNodeToken(node.test); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(testToken), nextToken: testToken, message: 'Space found after semicolon' }); } |
| ✓ Negative was executed (else) | /**··· * Disall if (node.update) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallow spaces in bet{ var updateToken = file.getFirstNodeToken(node.update); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(updateToken), nextToken: updateToken, message: 'Space found after semicolon' }); } |
| ✓ Negative was executed (else) | /**··· * Disall }); |
| Function (anonymous_628) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_629) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(options) { assert( typeof options === 'object', this.getOptionName() + ' option must be the object' ); if ('beforeOpeningRoundBrace' in options) { assert( options.beforeOpeningRoundBrace === true, this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } if ('beforeOpeningCurlyBrace' in options) { assert( options.beforeOpeningCurlyBrace === true, this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } assert( options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, this.getOptionName() + ' must have beforeOpeningCurlyBrace or beforeOpeningRoundBrace property' ); this._beforeOpeningRoundBrace = Boolean(options.beforeOpeningRoundBrace); this._beforeOpeningCurlyBrace = Boolean(options.beforeOpeningCurlyBrace); }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space before `()` or `{}` in func{ assert( options.beforeOpeningRoundBrace === true, this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | /**··· * Di if ('beforeOpeningCurlyBrace' in options) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space before `()` or `{}` in func{ assert( options.beforeOpeningCurlyBrace === true, this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | /**··· * Di assert( |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disallows space before `()` or `{}` in foptions.beforeOpeningRoundBrace, |
| ✓ Was returned | /**··· * Disaloptions.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, |
| Function (anonymous_630) | |
|---|---|
| ✓ Was called | /**··· * Disallows spfunction() { return 'disallowSpacesInFunctionDeclaration'; }, |
| Function (anonymous_631) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { var beforeOpeningRoundBrace = this._beforeOpeningRoundBrace; var beforeOpeningCurlyBrace = this._beforeOpeningCurlyBrace; file.iterateNodesByType(['FunctionDeclaration'], function(node) { // Exception for `export default function` #1376 if (!node.id) { return; } if (beforeOpeningRoundBrace) { var functionToken = file.getFirstNodeToken(node.id); if (node.async && functionToken.value === 'async') { functionToken = file.getNextToken(functionToken); } // if generator, set token to be * instead if (node.generator && functionToken.value === 'function') { functionToken = file.getNextToken(functionToken); } errors.assert.noWhitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Illegal space before opening round brace' }); } if (beforeOpeningCurlyBrace) { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Illegal space before opening curly brace' }); } }); } |
| Function (anonymous_632) | |
|---|---|
| ✓ Was called | /**··· * Disallows space before `()` or `{}` in function defunction(node) { // Exception for `export default function` #1376 if (!node.id) { return; } if (beforeOpeningRoundBrace) { var functionToken = file.getFirstNodeToken(node.id); if (node.async && functionToken.value === 'async') { functionToken = file.getNextToken(functionToken); } // if generator, set token to be * instead if (node.generator && functionToken.value === 'function') { functionToken = file.getNextToken(functionToken); } errors.assert.noWhitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Illegal space before opening round brace' }); } if (beforeOpeningCurlyBrace) { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Illegal space before opening curly brace' }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space bef{ return; } |
| ✓ Negative was executed (else) | /**··· * Disall if (beforeOpeningRoundBrace) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space before `()` or `{}{ var functionToken = file.getFirstNodeToken(node.id); if (node.async && functionToken.value === 'async') { functionToken = file.getNextToken(functionToken); } // if generator, set token to be * instead if (node.generator && functionToken.value === 'function') { functionToken = file.getNextToken(functionToken); } errors.assert.noWhitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Illegal space before opening round brace' }); } |
| ✓ Negative was executed (else) | /**··· * Disall if (beforeOpeningCurlyBrace) { |
| Branch IfStatement | |
|---|---|
| ✗ Positive was not executed (if) | /**··· * Disallows space before `()` or `{}` in function declarations{ functionToken = file.getNextToken(functionToken); } |
| ✓ Negative was executed (else) | /**··· * Disallows // if generator, set token to be * instead |
| Branch LogicalExpression | |
| ✗ Was not returned | /**··· * Disallows space before `()`functionToken.value === 'async') { |
| ✓ Was returned | /**··· * Disallows spanode.async && functionToken.value === 'async') { |
| Branch IfStatement | |
|---|---|
| ✗ Positive was not executed (if) | /**··· * Disallows space before `()` or `{}` in function declarations. * *{ functionToken = file.getNextToken(functionToken); } |
| ✓ Negative was executed (else) | /**··· * Disallows errors.assert.noWhitespaceBetween({ |
| Branch LogicalExpression | |
| ✗ Was not returned | /**··· * Disallows space before `()` or functionToken.value === 'function') { |
| ✓ Was returned | /**··· * Disallows spanode.generator && functionToken.value === 'function') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space before `()` or `{}{ var bodyToken = file.getFirstNodeToken(node.body); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Illegal space before opening curly brace' }); } |
| ✓ Negative was executed (else) | /**··· * Disall }); |
| Function (anonymous_633) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_634) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(options) { assert( typeof options === 'object', this.getOptionName() + ' option must be the object' ); if ('beforeOpeningRoundBrace' in options) { assert( options.beforeOpeningRoundBrace === true, this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } if ('beforeOpeningCurlyBrace' in options) { assert( options.beforeOpeningCurlyBrace === true, this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } assert( options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, this.getOptionName() + ' must have beforeOpeningCurlyBrace or beforeOpeningRoundBrace property' ); this._beforeOpeningRoundBrace = Boolean(options.beforeOpeningRoundBrace); this._beforeOpeningCurlyBrace = Boolean(options.beforeOpeningCurlyBrace); }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space before `()` or `{}` in func{ assert( options.beforeOpeningRoundBrace === true, this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | /**··· * Di if ('beforeOpeningCurlyBrace' in options) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space before `()` or `{}` in func{ assert( options.beforeOpeningCurlyBrace === true, this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | /**··· * Di assert( |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disallows space before `()` or `{}` in foptions.beforeOpeningRoundBrace, |
| ✓ Was returned | /**··· * Disaloptions.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, |
| Function (anonymous_635) | |
|---|---|
| ✓ Was called | /**··· * Disallows spfunction() { return 'disallowSpacesInFunctionExpression'; }, |
| Function (anonymous_636) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { var beforeOpeningRoundBrace = this._beforeOpeningRoundBrace; var beforeOpeningCurlyBrace = this._beforeOpeningCurlyBrace; file.iterateNodesByType('FunctionExpression', function(node) { // for a named function, use node.id var functionNode = node.id || node; var parent = node.parentNode; // Ignore syntactic sugar for getters and setters. if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { return; } // shorthand or constructor methods if (parent.method || parent.type === 'MethodDefinition') { functionNode = parent.key; } if (beforeOpeningRoundBrace) { var functionToken = file.getFirstNodeToken(functionNode); if (node.async && functionToken.value === 'async') { functionToken = file.getNextToken(functionToken); } // if generator, set token to be * instead if (node.generator && functionToken.value === 'function') { functionToken = file.getNextToken(functionToken); } errors.assert.noWhitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Illegal space before opening round brace' }); } if (beforeOpeningCurlyBrace) { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Illegal space before opening curly brace' }); } }); } |
| Function (anonymous_637) | |
|---|---|
| ✓ Was called | /**··· * Disallows space before `()` or `{}` in functionfunction(node) { // for a named function, use node.id var functionNode = node.id || node; var parent = node.parentNode; // Ignore syntactic sugar for getters and setters. if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { return; } // shorthand or constructor methods if (parent.method || parent.type === 'MethodDefinition') { functionNode = parent.key; } if (beforeOpeningRoundBrace) { var functionToken = file.getFirstNodeToken(functionNode); if (node.async && functionToken.value === 'async') { functionToken = file.getNextToken(functionToken); } // if generator, set token to be * instead if (node.generator && functionToken.value === 'function') { functionToken = file.getNextToken(functionToken); } errors.assert.noWhitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Illegal space before opening round brace' }); } if (beforeOpeningCurlyBrace) { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Illegal space before opening curly brace' }); } }); |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disallows space before `()` or `{}`node; |
| ✓ Was returned | /**··· * Disallows space before `node.id || node; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space before `()` or `{}` in function expressions (both [named](#disallowspaces{ return; } |
| ✓ Negative was executed (else) | /**··· * Disall // shorthand or constructor methods |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows space before `()` or `{}` in fparent.kind === 'get' || parent.kind === 'set')) { |
| ✓ Was returned | /**··· * Disallowsparent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows space before `()` or `{}` in function expressions (bothparent.kind === 'set')) { |
| ✓ Was returned | /**··· * Disallows space before `()` or `{}` in fparent.kind === 'get' || parent.kind === 'set')) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space before `()` or `{}` in function expressions (b{ functionNode = parent.key; } |
| ✓ Negative was executed (else) | /**··· * Disall if (beforeOpeningRoundBrace) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows space before `()parent.type === 'MethodDefinition') { |
| ✓ Was returned | /**··· * Disallowsparent.method || parent.type === 'MethodDefinition') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space before `()` or `{}{ var functionToken = file.getFirstNodeToken(functionNode); if (node.async && functionToken.value === 'async') { functionToken = file.getNextToken(functionToken); } // if generator, set token to be * instead if (node.generator && functionToken.value === 'function') { functionToken = file.getNextToken(functionToken); } errors.assert.noWhitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Illegal space before opening round brace' }); } |
| ✓ Negative was executed (else) | /**··· * Disall if (beforeOpeningCurlyBrace) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space before `()` or `{}` in function expressions { functionToken = file.getNextToken(functionToken); } |
| ✓ Negative was executed (else) | /**··· * Disallows // if generator, set token to be * instead |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows space before `()`functionToken.value === 'async') { |
| ✓ Was returned | /**··· * Disallows spanode.async && functionToken.value === 'async') { |
| Branch IfStatement | |
|---|---|
| ✗ Positive was not executed (if) | /**··· * Disallows space before `()` or `{}` in function expressions (both [{ functionToken = file.getNextToken(functionToken); } |
| ✓ Negative was executed (else) | /**··· * Disallows errors.assert.noWhitespaceBetween({ |
| Branch LogicalExpression | |
| ✗ Was not returned | /**··· * Disallows space before `()` or functionToken.value === 'function') { |
| ✓ Was returned | /**··· * Disallows spanode.generator && functionToken.value === 'function') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space before `()` or `{}{ var bodyToken = file.getFirstNodeToken(node.body); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Illegal space before opening curly brace' }); } |
| ✓ Negative was executed (else) | /**··· * Disall }); |
| Function (anonymous_638) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_639) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(options) { assert( typeof options === 'object', this.getOptionName() + ' option must be the object' ); if ('beforeOpeningRoundBrace' in options) { assert( options.beforeOpeningRoundBrace === true, this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } if ('beforeOpeningCurlyBrace' in options) { assert( options.beforeOpeningCurlyBrace === true, this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } assert( options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, this.getOptionName() + ' must have beforeOpeningCurlyBrace or beforeOpeningRoundBrace property' ); this._beforeOpeningRoundBrace = Boolean(options.beforeOpeningRoundBrace); this._beforeOpeningCurlyBrace = Boolean(options.beforeOpeningCurlyBrace); }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space before `()` or `{}` in func{ assert( options.beforeOpeningRoundBrace === true, this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | /**··· * Di if ('beforeOpeningCurlyBrace' in options) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space before `()` or `{}` in func{ assert( options.beforeOpeningCurlyBrace === true, this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | /**··· * Di assert( |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disallows space before `()` or `{}` in foptions.beforeOpeningRoundBrace, |
| ✓ Was returned | /**··· * Disaloptions.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, |
| Function (anonymous_640) | |
|---|---|
| ✓ Was called | /**··· * Disallows spfunction() { return 'disallowSpacesInFunction'; }, |
| Function (anonymous_641) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { var beforeOpeningRoundBrace = this._beforeOpeningRoundBrace; var beforeOpeningCurlyBrace = this._beforeOpeningCurlyBrace; file.iterateNodesByType(['FunctionDeclaration', 'FunctionExpression'], function(node) { // for a named function, use node.id var functionNode = node.id || node; var parent = node.parentNode; // Ignore syntactic sugar for getters and setters. if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { return; } // shorthand or constructor methods if (parent.method || parent.type === 'MethodDefinition') { functionNode = parent.key; } if (beforeOpeningRoundBrace) { var functionToken = file.getFirstNodeToken(functionNode); if (node.async && functionToken.value === 'async') { functionToken = file.getNextToken(functionToken); } // if generator, set token to be * instead if (node.generator && functionToken.value === 'function') { functionToken = file.getNextToken(functionToken); } errors.assert.noWhitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Illegal space before opening round brace' }); } if (beforeOpeningCurlyBrace) { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Illegal space before opening curly brace' }); } }); } |
| Function (anonymous_642) | |
|---|---|
| ✓ Was called | /**··· * Disallows space before `()` or `{}` in function expressions (both [namedfunction(node) { // for a named function, use node.id var functionNode = node.id || node; var parent = node.parentNode; // Ignore syntactic sugar for getters and setters. if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { return; } // shorthand or constructor methods if (parent.method || parent.type === 'MethodDefinition') { functionNode = parent.key; } if (beforeOpeningRoundBrace) { var functionToken = file.getFirstNodeToken(functionNode); if (node.async && functionToken.value === 'async') { functionToken = file.getNextToken(functionToken); } // if generator, set token to be * instead if (node.generator && functionToken.value === 'function') { functionToken = file.getNextToken(functionToken); } errors.assert.noWhitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Illegal space before opening round brace' }); } if (beforeOpeningCurlyBrace) { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Illegal space before opening curly brace' }); } }); |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disallows space before `()` or `{}`node; |
| ✓ Was returned | /**··· * Disallows space before `node.id || node; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space before `()` or `{}` in function expressions (both [named](#disallowspaces{ return; } |
| ✓ Negative was executed (else) | /**··· * Disall // shorthand or constructor methods |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows space before `()` or `{}` in fparent.kind === 'get' || parent.kind === 'set')) { |
| ✓ Was returned | /**··· * Disallowsparent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows space before `()` or `{}` in function expressions (bothparent.kind === 'set')) { |
| ✓ Was returned | /**··· * Disallows space before `()` or `{}` in fparent.kind === 'get' || parent.kind === 'set')) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space before `()` or `{}` in function expressions (b{ functionNode = parent.key; } |
| ✓ Negative was executed (else) | /**··· * Disall if (beforeOpeningRoundBrace) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows space before `()parent.type === 'MethodDefinition') { |
| ✓ Was returned | /**··· * Disallowsparent.method || parent.type === 'MethodDefinition') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space before `()` or `{}{ var functionToken = file.getFirstNodeToken(functionNode); if (node.async && functionToken.value === 'async') { functionToken = file.getNextToken(functionToken); } // if generator, set token to be * instead if (node.generator && functionToken.value === 'function') { functionToken = file.getNextToken(functionToken); } errors.assert.noWhitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Illegal space before opening round brace' }); } |
| ✓ Negative was executed (else) | /**··· * Disall if (beforeOpeningCurlyBrace) { |
| Branch IfStatement | |
|---|---|
| ✗ Positive was not executed (if) | /**··· * Disallows space before `()` or `{}` in function expressions { functionToken = file.getNextToken(functionToken); } |
| ✓ Negative was executed (else) | /**··· * Disallows // if generator, set token to be * instead |
| Branch LogicalExpression | |
| ✗ Was not returned | /**··· * Disallows space before `()`functionToken.value === 'async') { |
| ✓ Was returned | /**··· * Disallows spanode.async && functionToken.value === 'async') { |
| Branch IfStatement | |
|---|---|
| ✗ Positive was not executed (if) | /**··· * Disallows space before `()` or `{}` in function expressions (both [{ functionToken = file.getNextToken(functionToken); } |
| ✓ Negative was executed (else) | /**··· * Disallows errors.assert.noWhitespaceBetween({ |
| Branch LogicalExpression | |
| ✗ Was not returned | /**··· * Disallows space before `()` or functionToken.value === 'function') { |
| ✓ Was returned | /**··· * Disallows spanode.generator && functionToken.value === 'function') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space before `()` or `{}{ var bodyToken = file.getFirstNodeToken(node.body); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Illegal space before opening curly brace' }); } |
| ✓ Negative was executed (else) | /**··· * Disall }); |
| Function (anonymous_643) | |
|---|---|
| ✓ Was called | /**··· * Disallow sfunction() {}; |
| Function (anonymous_644) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(options) { assert( typeof options === 'object', this.getOptionName() + ' option must be an object' ); if ('beforeStar' in options) { assert( options.beforeStar === true, this.getOptionName() + '.beforeStar ' + 'property requires true value or should be removed' ); } if ('afterStar' in options) { assert( options.afterStar === true, this.getOptionName() + '.afterStar ' + 'property requires true value or should be removed' ); } assert( options.beforeStar || options.afterStar, this.getOptionName() + ' must have beforeStar or afterStar property' ); this._beforeStar = options.beforeStar; this._afterStar = options.afterStar; }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallow space before or after{ assert( options.beforeStar === true, this.getOptionName() + '.beforeStar ' + 'property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | /**··· * Di if ('afterStar' in options) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallow space before or afte{ assert( options.afterStar === true, this.getOptionName() + '.afterStar ' + 'property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | /**··· * Di assert( |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disallow space before or afoptions.afterStar, |
| ✓ Was returned | /**··· * Disaloptions.beforeStar || options.afterStar, |
| Function (anonymous_645) | |
|---|---|
| ✓ Was called | /**··· * Disallow spafunction() { return 'disallowSpacesInGenerator'; }, |
| Function (anonymous_646) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { var beforeStar = this._beforeStar; var afterStar = this._afterStar; file.iterateNodesByType(['FunctionDeclaration', 'FunctionExpression'], function(node) { if (!node.generator) { return; } var parent = node.parentNode; var shorthand = false; // shorthand or constructor methods if (parent.method || parent.type === 'MethodDefinition') { shorthand = true; node = parent.key; } var currentToken = file.getFirstNodeToken(node); if (node.async && currentToken.value === 'async') { currentToken = file.getNextToken(currentToken); } if (beforeStar && !shorthand) { // currentToken assigned outside of function errors.assert.noWhitespaceBetween({ token: currentToken, nextToken: file.getNextToken(currentToken), message: 'Illegal space before star' }); } if (afterStar) { if (shorthand) { currentToken = file.getPrevToken(currentToken); } else { // currentToken reassigned for star token currentToken = file.getNextToken(currentToken); } errors.assert.noWhitespaceBetween({ token: currentToken, nextToken: file.getNextToken(currentToken), message: 'Illegal space after star' }); } }); } |
| Function (anonymous_647) | |
|---|---|
| ✓ Was called | /**··· * Disallow space before or after `*` in generator functions * * Types: `function(node) { if (!node.generator) { return; } var parent = node.parentNode; var shorthand = false; // shorthand or constructor methods if (parent.method || parent.type === 'MethodDefinition') { shorthand = true; node = parent.key; } var currentToken = file.getFirstNodeToken(node); if (node.async && currentToken.value === 'async') { currentToken = file.getNextToken(currentToken); } if (beforeStar && !shorthand) { // currentToken assigned outside of function errors.assert.noWhitespaceBetween({ token: currentToken, nextToken: file.getNextToken(currentToken), message: 'Illegal space before star' }); } if (afterStar) { if (shorthand) { currentToken = file.getPrevToken(currentToken); } else { // currentToken reassigned for star token currentToken = file.getNextToken(currentToken); } errors.assert.noWhitespaceBetween({ token: currentToken, nextToken: file.getNextToken(currentToken), message: 'Illegal space after star' }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallow space before or a{ return; } |
| ✓ Negative was executed (else) | /**··· * Disall var parent = node.parentNode; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallow space before or after `*` in generator functions * { shorthand = true; node = parent.key; } |
| ✓ Negative was executed (else) | /**··· * Disall var currentToken = file.getFirstNodeToken(node); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallow space before or aparent.type === 'MethodDefinition') { |
| ✓ Was returned | /**··· * Disallow parent.method || parent.type === 'MethodDefinition') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallow space before or after `*` in generator functio{ currentToken = file.getNextToken(currentToken); } |
| ✓ Negative was executed (else) | /**··· * Disall if (beforeStar && !shorthand) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallow space before ocurrentToken.value === 'async') { |
| ✓ Was returned | /**··· * Disallow node.async && currentToken.value === 'async') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallow space before or after `*` { // currentToken assigned outside of function errors.assert.noWhitespaceBetween({ token: currentToken, nextToken: file.getNextToken(currentToken), message: 'Illegal space before star' }); } |
| ✓ Negative was executed (else) | /**··· * Disall if (afterStar) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallow space before o!shorthand) { |
| ✓ Was returned | /**··· * Disallow beforeStar && !shorthand) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallow space befor{ if (shorthand) { currentToken = file.getPrevToken(currentToken); } else { // currentToken reassigned for star token currentToken = file.getNextToken(currentToken); } errors.assert.noWhitespaceBetween({ token: currentToken, nextToken: file.getNextToken(currentToken), message: 'Illegal space after star' }); } |
| ✓ Negative was executed (else) | /**··· * Disall }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallow space before or{ currentToken = file.getPrevToken(currentToken); } else { |
| ✓ Negative was executed (else) | /**··· * Disallow space b{ // currentToken reassigned for star token currentToken = file.getNextToken(currentToken); } |
| Function (anonymous_648) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_649) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(options) { assert( typeof options === 'object', this.getOptionName() + ' option must be the object' ); if ('beforeOpeningRoundBrace' in options) { assert( options.beforeOpeningRoundBrace === true, this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } if ('beforeOpeningCurlyBrace' in options) { assert( options.beforeOpeningCurlyBrace === true, this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } assert( options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, this.getOptionName() + ' must have beforeOpeningCurlyBrace ' + 'or beforeOpeningRoundBrace property' ); this._beforeOpeningRoundBrace = Boolean(options.beforeOpeningRoundBrace); this._beforeOpeningCurlyBrace = Boolean(options.beforeOpeningCurlyBrace); }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space before `()` or `{}` in name{ assert( options.beforeOpeningRoundBrace === true, this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | /**··· * Di if ('beforeOpeningCurlyBrace' in options) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space before `()` or `{}` in name{ assert( options.beforeOpeningCurlyBrace === true, this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | /**··· * Di assert( |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disallows space before `()` or `{}` in noptions.beforeOpeningRoundBrace, |
| ✓ Was returned | /**··· * Disaloptions.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, |
| Function (anonymous_650) | |
|---|---|
| ✓ Was called | /**··· * Disallows spfunction() { return 'disallowSpacesInNamedFunctionExpression'; }, |
| Function (anonymous_651) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { var beforeOpeningRoundBrace = this._beforeOpeningRoundBrace; var beforeOpeningCurlyBrace = this._beforeOpeningCurlyBrace; file.iterateNodesByType(['FunctionExpression'], function(node) { var functionNode = node.id; var parent = node.parentNode; // Ignore syntactic sugar for getters and setters. if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { return; } // shorthand or constructor methods if (parent.method || parent.type === 'MethodDefinition') { functionNode = parent.key; } // named function expressions only if (node.id) { if (beforeOpeningRoundBrace) { var functionToken = file.getFirstNodeToken(functionNode); if (node.async && functionToken.value === 'async') { functionToken = file.getNextToken(functionToken); } errors.assert.noWhitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Illegal space before opening round brace' }); } if (beforeOpeningCurlyBrace) { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Illegal space before opening curly brace' }); } } }); } |
| Function (anonymous_652) | |
|---|---|
| ✓ Was called | /**··· * Disallows space before `()` or `{}` in named funcfunction(node) { var functionNode = node.id; var parent = node.parentNode; // Ignore syntactic sugar for getters and setters. if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { return; } // shorthand or constructor methods if (parent.method || parent.type === 'MethodDefinition') { functionNode = parent.key; } // named function expressions only if (node.id) { if (beforeOpeningRoundBrace) { var functionToken = file.getFirstNodeToken(functionNode); if (node.async && functionToken.value === 'async') { functionToken = file.getNextToken(functionToken); } errors.assert.noWhitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Illegal space before opening round brace' }); } if (beforeOpeningCurlyBrace) { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Illegal space before opening curly brace' }); } } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space before `()` or `{}` in named function expressions. * * Type: `Object` { return; } |
| ✓ Negative was executed (else) | /**··· * Disall // shorthand or constructor methods |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows space before `()` or `{}` in nparent.kind === 'get' || parent.kind === 'set')) { |
| ✓ Was returned | /**··· * Disallowsparent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows space before `()` or `{}` in named function expressionsparent.kind === 'set')) { |
| ✓ Was returned | /**··· * Disallows space before `()` or `{}` in nparent.kind === 'get' || parent.kind === 'set')) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space before `()` or `{}` in named function expressi{ functionNode = parent.key; } |
| ✓ Negative was executed (else) | /**··· * Disall // named function expressions only |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows space before `()parent.type === 'MethodDefinition') { |
| ✓ Was returned | /**··· * Disallowsparent.method || parent.type === 'MethodDefinition') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space be{ if (beforeOpeningRoundBrace) { var functionToken = file.getFirstNodeToken(functionNode); if (node.async && functionToken.value === 'async') { functionToken = file.getNextToken(functionToken); } errors.assert.noWhitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Illegal space before opening round brace' }); } if (beforeOpeningCurlyBrace) { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Illegal space before opening curly brace' }); } } |
| ✓ Negative was executed (else) | /**··· * Disall }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space before `()` or `{}` in{ var functionToken = file.getFirstNodeToken(functionNode); if (node.async && functionToken.value === 'async') { functionToken = file.getNextToken(functionToken); } errors.assert.noWhitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Illegal space before opening round brace' }); } |
| ✓ Negative was executed (else) | /**··· * Disallows if (beforeOpeningCurlyBrace) { |
| Branch IfStatement | |
|---|---|
| ✗ Positive was not executed (if) | /**··· * Disallows space before `()` or `{}` in named function expression{ functionToken = file.getNextToken(functionToken); } |
| ✓ Negative was executed (else) | /**··· * Disallows spac errors.assert.noWhitespaceBetween({ |
| Branch LogicalExpression | |
| ✗ Was not returned | /**··· * Disallows space before `()` or functionToken.value === 'async') { |
| ✓ Was returned | /**··· * Disallows space bnode.async && functionToken.value === 'async') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space before `()` or `{}` in{ var bodyToken = file.getFirstNodeToken(node.body); errors.assert.noWhitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Illegal space before opening curly brace' }); } |
| ✓ Negative was executed (else) | /**··· * Disallows } |
| Function (anonymous_653) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_654) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(value) { var mode; var modes = { 'all': true, 'nested': true }; var isObject = typeof value === 'object'; var error = this.getOptionName() + ' rule' + ' requires string value "all" or "nested" or object'; if (typeof value === 'string' || value === true) { assert(modes[value === true ? 'all' : value], error); } else if (isObject) { assert('allExcept' in value, error); } else { assert(false, error); } this._exceptions = {}; if (isObject) { (value.allExcept || []).forEach(function(value) { this._exceptions[value] = true; }, this); } else { mode = value; } if (mode === 'nested') { this._exceptions['['] = this._exceptions[']'] = true; } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space after opening array square bracket{ assert(modes[value === true ? 'all' : value], error); } else if (isObject) { |
| ✓ Negative was executed (else) | /**··· * Disallowif (isObject) { assert('allExcept' in value, error); } else { assert(false, error); } |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows space after opening arravalue === true) { |
| ✓ Was returned | /**··· * Disaltypeof value === 'string' || value === true) { |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | /**··· * Disallows space after opening array'all' : value], error); |
| ✓ Negative was returned (: ...) | /**··· * Disallows space after opening array square value], error); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space after { assert('allExcept' in value, error); } else { |
| ✓ Negative was executed (else) | /**··· * Disallow{ assert(false, error); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space{ (value.allExcept || []).forEach(function(value) { this._exceptions[value] = true; }, this); } else { |
| ✓ Negative was executed (else) | /**··· * Disallow{ mode = value; } |
| Function (anonymous_655) | |
|---|---|
| ✓ Was called | /**··· * Disallows space after opening array sfunction(value) { this._exceptions[value] = true; }, this); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows space after ope[]).forEach(function(value) { |
| ✓ Was returned | /**··· * Disallvalue.allExcept || []).forEach(function(value) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space after op{ this._exceptions['['] = this._exceptions[']'] = true; } |
| ✓ Negative was executed (else) | /**··· * Di }, |
| Function (anonymous_656) | |
|---|---|
| ✓ Was called | /**··· * Disallows spfunction() { return 'disallowSpacesInsideArrayBrackets'; }, |
| Function (anonymous_657) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { var exceptions = this._exceptions; file.iterateNodesByType('ArrayExpression', function(node) { var openBracket = file.getFirstNodeToken(node); var afterOpen = file.getNextToken(openBracket, {includeComments: true}); var closeBracket = file.getLastNodeToken(node); var beforeClose = file.getPrevToken(closeBracket, {includeComments: true}); // Skip for empty array brackets if (afterOpen.value === ']') { return; } if (!(afterOpen.value in exceptions)) { errors.assert.noWhitespaceBetween({ token: openBracket, nextToken: afterOpen, message: 'Illegal space after opening bracket' }); } if (!(beforeClose.value in exceptions)) { errors.assert.noWhitespaceBetween({ token: beforeClose, nextToken: closeBracket, message: 'Illegal space before closing bracket' }); } }); } |
| Function (anonymous_658) | |
|---|---|
| ✓ Was called | /**··· * Disallows space after opening array square bfunction(node) { var openBracket = file.getFirstNodeToken(node); var afterOpen = file.getNextToken(openBracket, {includeComments: true}); var closeBracket = file.getLastNodeToken(node); var beforeClose = file.getPrevToken(closeBracket, {includeComments: true}); // Skip for empty array brackets if (afterOpen.value === ']') { return; } if (!(afterOpen.value in exceptions)) { errors.assert.noWhitespaceBetween({ token: openBracket, nextToken: afterOpen, message: 'Illegal space after opening bracket' }); } if (!(beforeClose.value in exceptions)) { errors.assert.noWhitespaceBetween({ token: beforeClose, nextToken: closeBracket, message: 'Illegal space before closing bracket' }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space after opening arra{ return; } |
| ✓ Negative was executed (else) | /**··· * Disall if (!(afterOpen.value in exceptions)) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space after opening array square { errors.assert.noWhitespaceBetween({ token: openBracket, nextToken: afterOpen, message: 'Illegal space after opening bracket' }); } |
| ✓ Negative was executed (else) | /**··· * Disall if (!(beforeClose.value in exceptions)) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space after opening array square br{ errors.assert.noWhitespaceBetween({ token: beforeClose, nextToken: closeBracket, message: 'Illegal space before closing bracket' }); } |
| ✓ Negative was executed (else) | /**··· * Disall }); |
| Function (anonymous_659) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_660) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(value) { var isObject = typeof value === 'object'; var error = this.getOptionName() + ' rule requires string value true or object'; if (isObject) { assert('allExcept' in value, error); } else { assert(value === true, error); } this._exceptions = {}; if (isObject) { (value.allExcept || []).forEach(function(value) { this._exceptions[value] = true; }, this); } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space{ assert('allExcept' in value, error); } else { |
| ✓ Negative was executed (else) | /**··· * Disallow{ assert(value === true, error); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space{ (value.allExcept || []).forEach(function(value) { this._exceptions[value] = true; }, this); } |
| ✓ Negative was executed (else) | /**··· * Di }, |
| Function (anonymous_661) | |
|---|---|
| ✓ Was called | /**··· * Disallows space after opening square function(value) { this._exceptions[value] = true; }, this); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows space after ope[]).forEach(function(value) { |
| ✓ Was returned | /**··· * Disallvalue.allExcept || []).forEach(function(value) { |
| Function (anonymous_662) | |
|---|---|
| ✓ Was called | /**··· * Disallows spfunction() { return 'disallowSpacesInsideBrackets'; }, |
| Function (anonymous_663) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { var exceptions = this._exceptions; file.iterateTokenByValue('[', function(token) { var nextToken = file.getNextToken(token, { includeComments: true }); var value = nextToken.value; if (value in exceptions) { return; } // Skip for empty array brackets if (value === ']') { return; } errors.assert.noWhitespaceBetween({ token: token, nextToken: nextToken, message: 'Illegal space after opening bracket' }); }); file.iterateTokenByValue(']', function(token) { var prevToken = file.getPrevToken(token, { includeComments: true }); var value = prevToken.value; if (value in exceptions) { return; } // Skip for empty array brackets if (value === '[') { return; } errors.assert.noWhitespaceBetween({ token: prevToken, nextToken: token, message: 'Illegal space before closing bracket' }); }); } |
| Function (anonymous_664) | |
|---|---|
| ✓ Was called | /**··· * Disallows space after opening sfunction(token) { var nextToken = file.getNextToken(token, { includeComments: true }); var value = nextToken.value; if (value in exceptions) { return; } // Skip for empty array brackets if (value === ']') { return; } errors.assert.noWhitespaceBetween({ token: token, nextToken: nextToken, message: 'Illegal space after opening bracket' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space after opening { return; } |
| ✓ Negative was executed (else) | /**··· * Disall // Skip for empty array brackets |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space after op{ return; } |
| ✓ Negative was executed (else) | /**··· * Disall errors.assert.noWhitespaceBetween({ |
| Function (anonymous_665) | |
|---|---|
| ✓ Was called | /**··· * Disallows space after opening sfunction(token) { var prevToken = file.getPrevToken(token, { includeComments: true }); var value = prevToken.value; if (value in exceptions) { return; } // Skip for empty array brackets if (value === '[') { return; } errors.assert.noWhitespaceBetween({ token: prevToken, nextToken: token, message: 'Illegal space before closing bracket' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space after opening { return; } |
| ✓ Negative was executed (else) | /**··· * Disall // Skip for empty array brackets |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space after op{ return; } |
| ✓ Negative was executed (else) | /**··· * Disall errors.assert.noWhitespaceBetween({ |
| Function (anonymous_666) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_667) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(value) { var mode; var modes = { 'all': true, 'nested': true }; var isObject = typeof value === 'object'; var error = this.getOptionName() + ' rule' + ' requires string "all" or "nested", true value or object'; if (typeof value === 'string' || value === true) { assert(modes[value === true ? 'all' : value], error); } else if (isObject) { assert('allExcept' in value, error); } else { assert(false, error); } this._exceptions = {}; if (isObject) { (value.allExcept || []).forEach(function(value) { this._exceptions[value] = true; }, this); } else { mode = value; } if (mode === 'nested') { this._exceptions['}'] = true; } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space after opening object curly brace a{ assert(modes[value === true ? 'all' : value], error); } else if (isObject) { |
| ✓ Negative was executed (else) | /**··· * Disallowif (isObject) { assert('allExcept' in value, error); } else { assert(false, error); } |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows space after opening objevalue === true) { |
| ✓ Was returned | /**··· * Disaltypeof value === 'string' || value === true) { |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | /**··· * Disallows space after opening objec'all' : value], error); |
| ✓ Negative was returned (: ...) | /**··· * Disallows space after opening object curly value], error); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space after { assert('allExcept' in value, error); } else { |
| ✓ Negative was executed (else) | /**··· * Disallow{ assert(false, error); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space{ (value.allExcept || []).forEach(function(value) { this._exceptions[value] = true; }, this); } else { |
| ✓ Negative was executed (else) | /**··· * Disallow{ mode = value; } |
| Function (anonymous_668) | |
|---|---|
| ✓ Was called | /**··· * Disallows space after opening object function(value) { this._exceptions[value] = true; }, this); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows space after ope[]).forEach(function(value) { |
| ✓ Was returned | /**··· * Disallvalue.allExcept || []).forEach(function(value) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space after op{ this._exceptions['}'] = true; } |
| ✓ Negative was executed (else) | /**··· * Di }, |
| Function (anonymous_669) | |
|---|---|
| ✓ Was called | /**··· * Disallows spfunction() { return 'disallowSpacesInsideObjectBrackets'; }, |
| Function (anonymous_670) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { var exceptions = this._exceptions; file.iterateNodesByType(['ObjectExpression', 'ObjectPattern'], function(node) { var openingBracket = file.getFirstNodeToken(node); var nextToken = file.getNextToken(openingBracket); errors.assert.noWhitespaceBetween({ token: openingBracket, nextToken: nextToken, message: 'Illegal space after opening curly brace' }); var closingBracket = file.getLastNodeToken(node); var prevToken = file.getPrevToken(closingBracket); if (prevToken.value in exceptions) { return; } errors.assert.noWhitespaceBetween({ token: prevToken, nextToken: closingBracket, message: 'Illegal space before closing curly brace' }); }); } |
| Function (anonymous_671) | |
|---|---|
| ✓ Was called | /**··· * Disallows space after opening object curly brace and before closfunction(node) { var openingBracket = file.getFirstNodeToken(node); var nextToken = file.getNextToken(openingBracket); errors.assert.noWhitespaceBetween({ token: openingBracket, nextToken: nextToken, message: 'Illegal space after opening curly brace' }); var closingBracket = file.getLastNodeToken(node); var prevToken = file.getPrevToken(closingBracket); if (prevToken.value in exceptions) { return; } errors.assert.noWhitespaceBetween({ token: prevToken, nextToken: closingBracket, message: 'Illegal space before closing curly brace' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space after opening object cur{ return; } |
| ✓ Negative was executed (else) | /**··· * Disall errors.assert.noWhitespaceBetween({ |
| Function (anonymous_672) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_673) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(option) { var isObject = typeof option === 'object'; var error = this.getOptionName() + ' option requires' + ' true or object value with "only" properties '; // backcompat for 1.10: {all: true} #1027 if (isObject && option.all === true) { option = true; } if (typeof option === 'boolean') { assert(option === true, error); } else if (isObject) { assert('only' in option, error); } else { assert(false, error); } this._onlySingleQuote = false; this._onlyDoubleQuote = false; this._only = null; if (option.only) { this._only = {}; (option.only).forEach(function(value) { if (value === '\'') { this._onlySingleQuote = true; } if (value === '"') { this._onlyDoubleQuote = true; } this._only[value] = true; }, this); } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space after opening round br{ option = true; } |
| ✓ Negative was executed (else) | /**··· * Di if (typeof option === 'boolean') { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows space aoption.all === true) { |
| ✓ Was returned | /**··· * DisalisObject && option.all === true) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space after opening roun{ assert(option === true, error); } else if (isObject) { |
| ✓ Negative was executed (else) | /**··· * Disallowif (isObject) { assert('only' in option, error); } else { assert(false, error); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space after { assert('only' in option, error); } else { |
| ✓ Negative was executed (else) | /**··· * Disallow{ assert(false, error); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space af{ this._only = {}; (option.only).forEach(function(value) { if (value === '\'') { this._onlySingleQuote = true; } if (value === '"') { this._onlyDoubleQuote = true; } this._only[value] = true; }, this); } |
| ✓ Negative was executed (else) | /**··· * Di }, |
| Function (anonymous_674) | |
|---|---|
| ✓ Was called | /**··· * Disallows space after openifunction(value) { if (value === '\'') { this._onlySingleQuote = true; } if (value === '"') { this._onlyDoubleQuote = true; } this._only[value] = true; }, this); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space after opening{ this._onlySingleQuote = true; } |
| ✓ Negative was executed (else) | /**··· * Disallows if (value === '"') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space after openin{ this._onlyDoubleQuote = true; } |
| ✓ Negative was executed (else) | /**··· * Disallows this._only[value] = true; |
| Function (anonymous_675) | |
|---|---|
| ✓ Was called | /**··· * Disallows spfunction() { return 'disallowSpacesInsideParentheses'; }, |
| Function (anonymous_676) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { var only = this._only; var singleQuote = this._onlySingleQuote; var doubleQuote = this._onlyDoubleQuote; file.iterateTokenByValue('(', function(token) { var nextToken = file.getNextToken(token, {includeComments: true}); var value = nextToken.value; var shouldReturn = true; if (doubleQuote && nextToken.type === 'String' && value[0] === '"') { shouldReturn = false; } if (singleQuote && nextToken.type === 'String' && value[0] === '\'') { shouldReturn = false; } if (only && value in only) { shouldReturn = false; } if (!only) { shouldReturn = false; } if (shouldReturn) { return; } errors.assert.noWhitespaceBetween({ token: token, nextToken: nextToken, message: 'Illegal space after opening round bracket' }); }); file.iterateTokenByValue(')', function(token) { var prevToken = file.getPrevToken(token, {includeComments: true}); var value = prevToken.value; var shouldReturn = true; if (doubleQuote && prevToken.type === 'String' && value[value.length - 1] === '"') { shouldReturn = false; } if (singleQuote && prevToken.type === 'String' && value[value.length - 1] === '\'') { shouldReturn = false; } if (only) { if (value in only) { shouldReturn = false; } if ( value === ']' && file.getNodeByRange(prevToken.range[0]).type === 'MemberExpression' ) { shouldReturn = true; } } else { shouldReturn = false; } if (shouldReturn) { return; } errors.assert.noWhitespaceBetween({ token: prevToken, nextToken: token, message: 'Illegal space before closing round bracket' }); }); } |
| Function (anonymous_677) | |
|---|---|
| ✓ Was called | /**··· * Disallows space after opening rfunction(token) { var nextToken = file.getNextToken(token, {includeComments: true}); var value = nextToken.value; var shouldReturn = true; if (doubleQuote && nextToken.type === 'String' && value[0] === '"') { shouldReturn = false; } if (singleQuote && nextToken.type === 'String' && value[0] === '\'') { shouldReturn = false; } if (only && value in only) { shouldReturn = false; } if (!only) { shouldReturn = false; } if (shouldReturn) { return; } errors.assert.noWhitespaceBetween({ token: token, nextToken: nextToken, message: 'Illegal space after opening round bracket' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space after opening round bracket and before closing. * * Typ{ shouldReturn = false; } |
| ✓ Negative was executed (else) | /**··· * Disall if (singleQuote && nextToken.type === 'String' && value[0] === '\'') { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows space after opening round bracket and before value[0] === '"') { |
| ✓ Was returned | /**··· * DisallowsdoubleQuote && nextToken.type === 'String' && value[0] === '"') { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows space after opnextToken.type === 'String' && value[0] === '"') { |
| ✓ Was returned | /**··· * DisallowsdoubleQuote && nextToken.type === 'String' && value[0] === '"') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space after opening round bracket and before closing. * * Type{ shouldReturn = false; } |
| ✓ Negative was executed (else) | /**··· * Disall if (only && value in only) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows space after opening round bracket and before value[0] === '\'') { |
| ✓ Was returned | /**··· * DisallowssingleQuote && nextToken.type === 'String' && value[0] === '\'') { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows space after opnextToken.type === 'String' && value[0] === '\'') { |
| ✓ Was returned | /**··· * DisallowssingleQuote && nextToken.type === 'String' && value[0] === '\'') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space after opening ro{ shouldReturn = false; } |
| ✓ Negative was executed (else) | /**··· * Disall if (!only) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows space avalue in only) { |
| ✓ Was returned | /**··· * Disallowsonly && value in only) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space { shouldReturn = false; } |
| ✓ Negative was executed (else) | /**··· * Disall if (shouldReturn) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space after o{ return; } |
| ✓ Negative was executed (else) | /**··· * Disall errors.assert.noWhitespaceBetween({ |
| Function (anonymous_678) | |
|---|---|
| ✓ Was called | /**··· * Disallows space after opening rfunction(token) { var prevToken = file.getPrevToken(token, {includeComments: true}); var value = prevToken.value; var shouldReturn = true; if (doubleQuote && prevToken.type === 'String' && value[value.length - 1] === '"') { shouldReturn = false; } if (singleQuote && prevToken.type === 'String' && value[value.length - 1] === '\'') { shouldReturn = false; } if (only) { if (value in only) { shouldReturn = false; } if ( value === ']' && file.getNodeByRange(prevToken.range[0]).type === 'MemberExpression' ) { shouldReturn = true; } } else { shouldReturn = false; } if (shouldReturn) { return; } errors.assert.noWhitespaceBetween({ token: prevToken, nextToken: token, message: 'Illegal space before closing round bracket' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space after opening round bracket and before closing. * * Types: `Boolean` o{ shouldReturn = false; } |
| ✓ Negative was executed (else) | /**··· * Disall if (singleQuote && prevToken.type === 'String' && value[value.length - 1] === '\'') { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows space after opening round bracket and before value[value.length - 1] === '"') { |
| ✓ Was returned | /**··· * DisallowsdoubleQuote && prevToken.type === 'String' && value[value.length - 1] === '"') { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows space after opprevToken.type === 'String' && value[value.length - 1] === '"') { |
| ✓ Was returned | /**··· * DisallowsdoubleQuote && prevToken.type === 'String' && value[value.length - 1] === '"') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space after opening round bracket and before closing. * * Types: `Boolean` or{ shouldReturn = false; } |
| ✓ Negative was executed (else) | /**··· * Disall if (only) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows space after opening round bracket and before value[value.length - 1] === '\'') { |
| ✓ Was returned | /**··· * DisallowssingleQuote && prevToken.type === 'String' && value[value.length - 1] === '\'') { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows space after opprevToken.type === 'String' && value[value.length - 1] === '\'') { |
| ✓ Was returned | /**··· * DisallowssingleQuote && prevToken.type === 'String' && value[value.length - 1] === '\'') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space{ if (value in only) { shouldReturn = false; } if ( value === ']' && file.getNodeByRange(prevToken.range[0]).type === 'MemberExpression' ) { shouldReturn = true; } } else { |
| ✓ Negative was executed (else) | /**··· * Disallows sp{ shouldReturn = false; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space after openin{ shouldReturn = false; } |
| ✓ Negative was executed (else) | /**··· * Disallows if ( |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows s{ shouldReturn = true; } |
| ✓ Negative was executed (else) | /**··· * Disallows } else { |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disallows spafile.getNodeByRange(prevToken.range[0]).type === 'MemberExpression' |
| ✓ Was returned | /**··· * Disallows spavalue === ']' && |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space after o{ return; } |
| ✓ Negative was executed (else) | /**··· * Disall errors.assert.noWhitespaceBetween({ |
| Function (anonymous_679) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_680) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(value) { var isObject = typeof value === 'object'; var error = this.getOptionName() + ' rule requires string value true or object'; if (isObject) { assert('allExcept' in value, error); } else { assert(value === true, error); } this._exceptions = {}; if (isObject) { (value.allExcept || []).forEach(function(value) { this._exceptions[value] = true; }, this); } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space{ assert('allExcept' in value, error); } else { |
| ✓ Negative was executed (else) | /**··· * Disallow{ assert(value === true, error); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space{ (value.allExcept || []).forEach(function(value) { this._exceptions[value] = true; }, this); } |
| ✓ Negative was executed (else) | /**··· * Di }, |
| Function (anonymous_681) | |
|---|---|
| ✓ Was called | /**··· * Disallows space after opening and beffunction(value) { this._exceptions[value] = true; }, this); |
| Branch LogicalExpression | |
| ✗ Was not returned | /**··· * Disallows space after ope[]).forEach(function(value) { |
| ✓ Was returned | /**··· * Disallvalue.allExcept || []).forEach(function(value) { |
| Function (anonymous_682) | |
|---|---|
| ✓ Was called | /**··· * Disallows spfunction() { return 'disallowSpacesInsideParenthesizedExpression'; }, |
| Function (anonymous_683) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { var exceptions = this._exceptions; file.iterateTokenByValue('(', function(token) { var nextToken = file.getNextToken(token, {includeComments: true}); var value = nextToken.isComment ? nextToken.type === 'Block' ? '/*' : '//' : nextToken.value; // Skip empty parentheses and explicit exceptions if (value === ')' || value in exceptions) { return; } // Skip non-expression parentheses var type = TokenCategorizer.categorizeOpenParen(token, file); if (type !== 'ParenthesizedExpression') { return; } errors.assert.noWhitespaceBetween({ token: token, nextToken: nextToken, message: 'Illegal space after opening grouping parenthesis' }); }); file.iterateTokenByValue(')', function(token) { var prevToken = file.getPrevToken(token, {includeComments: true}); var value = prevToken.isComment ? prevToken.type === 'Block' ? '*/' : '' : prevToken.value; // Skip empty parentheses and explicit exceptions if (value === '(' || value in exceptions) { return; } // Skip non-expression parentheses var type = TokenCategorizer.categorizeCloseParen(token, file); if (type !== 'ParenthesizedExpression') { return; } errors.assert.noWhitespaceBetween({ token: prevToken, nextToken: token, message: 'Illegal space before closing grouping parenthesis' }); }); } |
| Function (anonymous_684) | |
|---|---|
| ✓ Was called | /**··· * Disallows space after opening afunction(token) { var nextToken = file.getNextToken(token, {includeComments: true}); var value = nextToken.isComment ? nextToken.type === 'Block' ? '/*' : '//' : nextToken.value; // Skip empty parentheses and explicit exceptions if (value === ')' || value in exceptions) { return; } // Skip non-expression parentheses var type = TokenCategorizer.categorizeOpenParen(token, file); if (type !== 'ParenthesizedExpression') { return; } errors.assert.noWhitespaceBetween({ token: token, nextToken: nextToken, message: 'Illegal space after opening grouping parenthesis' }); }); |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | /**··· * DisallowsnextToken.type === 'Block' ? '/*' : '//' : |
| ✓ Negative was returned (: ...) | /**··· * DisallowsnextToken.value; |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | /**··· * Disallows space after opening and befo'/*' : '//' : |
| ✓ Negative was returned (: ...) | /**··· * Disallows space after opening and before clos'//' : |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space after opening and before closin{ return; } |
| ✓ Negative was executed (else) | /**··· * Disall // Skip non-expression parentheses |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows space after openvalue in exceptions) { |
| ✓ Was returned | /**··· * Disallowsvalue === ')' || value in exceptions) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space after opening and before clos{ return; } |
| ✓ Negative was executed (else) | /**··· * Disall errors.assert.noWhitespaceBetween({ |
| Function (anonymous_685) | |
|---|---|
| ✓ Was called | /**··· * Disallows space after opening afunction(token) { var prevToken = file.getPrevToken(token, {includeComments: true}); var value = prevToken.isComment ? prevToken.type === 'Block' ? '*/' : '' : prevToken.value; // Skip empty parentheses and explicit exceptions if (value === '(' || value in exceptions) { return; } // Skip non-expression parentheses var type = TokenCategorizer.categorizeCloseParen(token, file); if (type !== 'ParenthesizedExpression') { return; } errors.assert.noWhitespaceBetween({ token: prevToken, nextToken: token, message: 'Illegal space before closing grouping parenthesis' }); }); |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | /**··· * DisallowsprevToken.type === 'Block' ? '*/' : '' : |
| ✓ Negative was returned (: ...) | /**··· * DisallowsprevToken.value; |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | /**··· * Disallows space after opening and befo'*/' : '' : |
| ✓ Negative was returned (: ...) | /**··· * Disallows space after opening and before clos'' : |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space after opening and before closin{ return; } |
| ✓ Negative was executed (else) | /**··· * Disall // Skip non-expression parentheses |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows space after openvalue in exceptions) { |
| ✓ Was returned | /**··· * Disallowsvalue === '(' || value in exceptions) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows space after opening and before clos{ return; } |
| ✓ Negative was executed (else) | /**··· * Disall errors.assert.noWhitespaceBetween({ |
| Function (anonymous_686) | |
|---|---|
| ✓ Was called | var assert = require('assert')function(token, file) {··· assert(token.value === '(', 'Input token must be a parenthesis'); var node = file.getNodeByRange(token.range[0]); var nodeType = node.type; var prevToken = file.getPrevToken(token); // Outermost grouping parenthesis if (!prevToken) { return 'ParenthesizedExpression'; } // Part of a parentheses-bearing statement (if, with, while, switch, etc.) if (prevToken.type === 'Keyword' && PAREN_KEYWORD_TYPE_RE.test(nodeType) && !NO_PAREN_KEYWORD_TYPE_RE.test(nodeType)) { return 'Statement'; } // Part of a function definition (declaration, expression, method, etc.) if (FUNCTION_TYPE_RE.test(nodeType) && // Name is optional for function expressions (prevToken.type === 'Identifier' || prevToken.value === 'function')) { return 'Function'; } // Part of a call expression var prevNode = file.getNodeByRange(prevToken.range[0]); if ((nodeType === 'CallExpression' || nodeType === 'NewExpression') && // Must not be inside an arguments list or other grouping parentheses prevToken.value !== ',' && prevToken.value !== '(' && // If the callee is parenthesized (e.g., `(foo.bar)()`), prevNode will match node // Otherwise (e.g., `foo.bar()`), prevToken must be the last token of the callee node (prevNode === node || prevToken === file.getLastNodeToken(node.callee))) { return 'CallExpression'; } // All remaining cases are grouping parentheses return 'ParenthesizedExpression'; }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require{··· return 'ParenthesizedExpression'; } |
| ✓ Negative was executed (else) | var a··· // Part of a parentheses-bearing statement (if, with, while, switch, etc.) |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var FUNCTION_TYPE{ return 'Statement'; } |
| ✓ Negative was executed (else) | var a··· // Part of a function definition (declaration, expression, method, etc.) |
| Branch LogicalExpression | |
| ✓ Was returned | var asse!NO_PAREN_KEYWORD_TYPE_RE.test(nodeType)) { |
| ✓ Was returned | var asseprevToken.type === 'Keyword' && PAREN_KEYWORD_TYPE_RE.test(nodeType) && |
| Branch LogicalExpression | |
| ✓ Was returned | var assert = require('assert');··· var FUNPAREN_KEYWORD_TYPE_RE.test(nodeType) && |
| ✓ Was returned | var asseprevToken.type === 'Keyword' && PAREN_KEYWORD_TYPE_RE.test(nodeType) && |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var FUNCTION_TYPE_RE = /Function/; var PAREN{ return 'Function'; } |
| ✓ Negative was executed (else) | var a··· // Part of a call expression |
| Branch LogicalExpression | |
| ✓ Was returned | var asserprevToken.type === 'Identifier' || prevToken.value === 'function')) { |
| ✓ Was returned | var asseFUNCTION_TYPE_RE.test(nodeType) && |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var assert = require('assert');··· var FUNCTIOprevToken.value === 'function')) { |
| ✓ Was returned | var asserprevToken.type === 'Identifier' || prevToken.value === 'function')) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var FUNCTION_TYPE_RE = /Function/; var PAREN_KEY{ return 'CallExpression'; } |
| ✓ Negative was executed (else) | var a··· // All remaining cases are grouping parentheses |
| Branch LogicalExpression | |
| ✓ Was returned | var asserprevNode === node || prevToken === file.getLastNodeToken(node.callee))) { |
| ✓ Was returned | var asse(nodeType === 'CallExpression' || nodeType === 'NewExpression') &&··· // Must not be inside an arguments list or other grouping parentheses prevToken.value !== ',' && prevToken.value !== '(' && |
| Branch LogicalExpression | |
| ✓ Was returned | var assert = require('assert');··· vaprevToken.value !== '(' && |
| ✓ Was returned | var asse(nodeType === 'CallExpression' || nodeType === 'NewExpression') &&··· // Must not be inside an arguments list or other grouping parentheses prevToken.value !== ',' && prevToken.value !== '(' && |
| Branch LogicalExpression | |
| ✓ Was returned | var asseprevToken.value !== ',' && prevToken.value !== '(' && |
| ✓ Was returned | var assernodeType === 'CallExpression' || nodeType === 'NewExpression') && |
| Branch LogicalExpression | |
| ✓ Was returned | var assert = require('assert');··· var FUNCTnodeType === 'NewExpression') && |
| ✓ Was returned | var assernodeType === 'CallExpression' || nodeType === 'NewExpression') && |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | var assert = require('assert')prevToken === file.getLastNodeToken(node.callee))) { |
| ✓ Was returned | var asserprevNode === node || prevToken === file.getLastNodeToken(node.callee))) { |
| Function (anonymous_687) | |
|---|---|
| ✓ Was called | var assert = require('assert');function(token, file) {··· assert(token.value === ')', 'Input token must be a parenthesis'); var node = file.getNodeByRange(token.range[0]); var nodeType = node.type; var nextToken = file.getNextToken(token); // Terminal statement if (nextToken.type === 'EOF') { switch (nodeType) { case 'DoWhileStatement': return 'Statement'; case 'CallExpression': case 'NewExpression': return 'CallExpression'; default: return 'ParenthesizedExpression'; } } // Part of a parentheses-bearing statement (if, with, while, switch, etc.) if (PAREN_KEYWORD_TYPE_RE.test(nodeType) && !NO_PAREN_KEYWORD_TYPE_RE.test(nodeType)) { // Closing parentheses for `switch` and `catch` must be followed by "{" // Closing parentheses for `do..while` may be the last punctuation inside a block if (nextToken.value === '{' || nextToken.value === '}') { return 'Statement'; } // Closing parentheses for other statements must be followed by a statement or declaration var nextNode = file.getNodeByRange(nextToken.range[0]); while (nextNode.range[0] >= token.range[1]) { if (QUASI_STATEMENT_TYPE_RE.test(nextNode.type)) { return 'Statement'; } nextNode = nextNode.parentNode; } } // Part of a function definition (declaration, expression, method, etc.) if (nextToken.value === '{' && FUNCTION_TYPE_RE.test(nodeType)) { return 'Function'; } // Part of a call expression if ((nodeType === 'CallExpression' || nodeType === 'NewExpression') && nextToken.range[0] >= node.range[1]) { return 'CallExpression'; } // All remaining cases are grouping parentheses return 'ParenthesizedExpression'; }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· v{ switch (nodeType) { case 'DoWhileStatement': return 'Statement'; case 'CallExpression': case 'NewExpression': return 'CallExpression'; default: return 'ParenthesizedExpression'; } } |
| ✓ Negative was executed (else) | var a··· // Part of a parentheses-bearing statement (if, with, while, switch, etc.) |
| Branch SwitchStatement | |
|---|---|
| ✓ Was evaluated | var assert =case 'DoWhileStatement':··· return 'Statement'; |
| ✓ Was evaluated | var assert =case 'CallExpression': |
| ✓ Was evaluated | var assert =case 'NewExpression':··· return 'CallExpression'; |
| ✓ Was evaluated | var assert =default:··· return 'ParenthesizedExpression'; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var FUNCTION_TYPE_RE = /Function/; var PAREN_KEYWORD_TYPE{ // Closing parentheses for `switch` and `catch` must be followed by "{" // Closing parentheses for `do..while` may be the last punctuation inside a block if (nextToken.value === '{' || nextToken.value === '}') { return 'Statement'; } // Closing parentheses for other statements must be followed by a statement or declaration var nextNode = file.getNodeByRange(nextToken.range[0]); while (nextNode.range[0] >= token.range[1]) { if (QUASI_STATEMENT_TYPE_RE.test(nextNode.type)) { return 'Statement'; } nextNode = nextNode.parentNode; } } |
| ✓ Negative was executed (else) | var a··· // Part of a function definition (declaration, expression, method, etc.) |
| Branch LogicalExpression | |
| ✓ Was returned | var assert = require('assert');··· var FUNCTION_TY!NO_PAREN_KEYWORD_TYPE_RE.test(nodeType)) { |
| ✓ Was returned | var assePAREN_KEYWORD_TYPE_RE.test(nodeType) && !NO_PAREN_KEYWORD_TYPE_RE.test(nodeType)) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var FUNCTION_TYPE_RE = /Functio{ return 'Statement'; } |
| ✓ Negative was executed (else) | var asser··· // Closing parentheses for other statements must be followed by a statement or declaration |
| Branch LogicalExpression | |
| ✓ Was returned | var assert = require('assert');··· var FUnextToken.value === '}') { |
| ✓ Was returned | var assert =nextToken.value === '{' || nextToken.value === '}') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var FUNCTION_TYPE_RE = /Func{ return 'Statement'; } |
| ✗ Negative was not executed (else) | var assert = ··· nextNode = nextNode.parentNode; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var FUNCTION_TYPE_RE = /Function/; { return 'Function'; } |
| ✓ Negative was executed (else) | var a··· // Part of a call expression |
| Branch LogicalExpression | |
| ✓ Was returned | var assert = require('assert');··· vaFUNCTION_TYPE_RE.test(nodeType)) { |
| ✓ Was returned | var assenextToken.value === '{' && FUNCTION_TYPE_RE.test(nodeType)) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var assert = require('assert');··· var FUNCTION{ return 'CallExpression'; } |
| ✓ Negative was executed (else) | var a··· // All remaining cases are grouping parentheses |
| Branch LogicalExpression | |
| ✓ Was returned | var assenextToken.range[0] >= node.range[1]) { |
| ✓ Was returned | var assernodeType === 'CallExpression' || nodeType === 'NewExpression') && |
| Branch LogicalExpression | |
| ✓ Was returned | var assert = require('assert');··· var FUNCTnodeType === 'NewExpression') && |
| ✓ Was returned | var assernodeType === 'CallExpression' || nodeType === 'NewExpression') && |
| Function (anonymous_688) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_689) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(options) { assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_690) | |
|---|---|
| ✓ Was called | /**··· * Disallows tafunction() { return 'disallowTabs'; }, |
| Function (anonymous_691) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { file.getLines().forEach(function(line, i) { var match = line.match(/\t/); if (match) { errors.add('Tab found', i + 1, match.index); } }); } |
| Function (anonymous_692) | |
|---|---|
| ✓ Was called | /**··· * Disallows tabs everywherefunction(line, i) { var match = line.match(/\t/); if (match) { errors.add('Tab found', i + 1, match.index); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows tabs e{ errors.add('Tab found', i + 1, match.index); } |
| ✓ Negative was executed (else) | /**··· * Disall }); |
| Function (anonymous_693) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_694) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(options) { assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_695) | |
|---|---|
| ✓ Was called | /**··· * Disallows anfunction() { return 'disallowTrailingComma'; }, |
| Function (anonymous_696) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { file.iterateNodesByType([ 'ObjectExpression', 'ArrayExpression', 'ObjectPattern', 'ArrayPattern' ], function(node) { var closingToken = file.getLastNodeToken(node); errors.assert.noTokenBefore({ token: closingToken, expectedTokenBefore: {type: 'Punctuator', value: ','}, message: 'Extra comma following the final element of an array or object literal' }); }); } |
| Function (anonymous_697) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(node) { var closingToken = file.getLastNodeToken(node); errors.assert.noTokenBefore({ token: closingToken, expectedTokenBefore: {type: 'Punctuator', value: ','}, message: 'Extra comma following the final element of an array or object literal' }); }); |
| Function (anonymous_698) | |
|---|---|
| ✓ Was called | /**··· * Requires afunction() {}; |
| Function (anonymous_699) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { assert( options === true || options === 'ignoreEmptyLines', this.getOptionName() + ' option requires a true value or "ignoreEmptyLines"' ); this._ignoreEmptyLines = options === 'ignoreEmptyLines'; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires all lines to endoptions === 'ignoreEmptyLines', |
| ✓ Was returned | /**··· * Requioptions === true || options === 'ignoreEmptyLines', |
| Function (anonymous_700) | |
|---|---|
| ✓ Was called | /**··· * Requires allfunction() { return 'disallowTrailingWhitespace'; }, |
| Function (anonymous_701) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var ignoreEmptyLines = this._ignoreEmptyLines; var lines = file.getLines(); for (var i = 0, l = lines.length; i < l; i++) { if (lines[i].match(/\s$/) && !(ignoreEmptyLines && lines[i].match(/^\s*$/))) { errors.cast({ message: 'Illegal trailing whitespace', line: i + 1, column: lines[i].length }); } } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires all lines to end on a non-whitespace character * * Types: `Boolean` or { errors.cast({ message: 'Illegal trailing whitespace', line: i + 1, column: lines[i].length }); } |
| ✓ Negative was executed (else) | /**··· * Requir } |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires all lines to end on a non!(ignoreEmptyLines && lines[i].match(/^\s*$/))) { |
| ✓ Was returned | /**··· * Requires lines[i].match(/\s$/) && !(ignoreEmptyLines && lines[i].match(/^\s*$/))) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires all lines to end on a non-whitespace character lines[i].match(/^\s*$/))) { |
| ✓ Was returned | /**··· * Requires all lines to end on a non-wignoreEmptyLines && lines[i].match(/^\s*$/))) { |
| Function (anonymous_702) | |
|---|---|
| ✓ Was called | /**··· * Reqfunction(file, error) { var ignoreEmptyLines = this._ignoreEmptyLines; var currentLineNumber = error.line; var linebreak = file.getLineBreaks()[0] || '\n'; var lines = file.getLines(); var fixed = false; var startLineNumber; var precedingToken; var targetToken; while (!precedingToken && currentLineNumber > 0) { precedingToken = file.getLastTokenOnLine(currentLineNumber, { includeComments: true }); currentLineNumber--; } if (precedingToken === null) { targetToken = file.getFirstToken({includeComments: true}); startLineNumber = 1; } else { targetToken = file.getNextToken(precedingToken, { includeComments: true }); startLineNumber = precedingToken.loc.end.line; if (precedingToken.isComment && precedingToken.loc.start.line <= error.line && precedingToken.loc.end.line >= error.line) { if (precedingToken.type === 'Block') { if (ignoreEmptyLines) { var blockLines = precedingToken.value.split(/\r\n|\n|\r/); for (var k = 0; k < blockLines.length; k++) { if (!blockLines[k].match(/^\s*$/) || k === 0) { blockLines[k] = blockLines[k].split(/\s+$/).join(''); } } precedingToken.value = blockLines.join(linebreak); } else { precedingToken.value = precedingToken.value .split(/[^\S\r\n]+\r\n|[^\S\n]+\n|[^\S\r]+\r/) .join(linebreak); } } else { precedingToken.value = precedingToken.value.split(/\s+$/).join(''); } fixed = true; } } if (targetToken !== null && !fixed) { var eolCount = targetToken.loc.start.line - startLineNumber + 1; var targetIndent = ''; var targetLine = lines[targetToken.loc.start.line - 1]; for (var j = 0, whitespace = targetLine.charAt(j); whitespace.match(/\s/); j++, whitespace = targetLine.charAt(j)) { targetIndent += whitespace; } file.setWhitespaceBefore(targetToken, new Array(eolCount).join(linebreak) + targetIndent); fixed = true; } if (!fixed && precedingToken && precedingToken.type === 'EOF') { precedingToken = file.getPrevToken(precedingToken, { includeWhitespace: true }); if (precedingToken.isWhitespace) { precedingToken.value = precedingToken.value.replace(/[^\S\n\r]$/g, ''); fixed = true; } } if (!fixed) { error.fixed = false; } } |
| Branch LogicalExpression | |
|---|---|
| ✗ Was not returned | /**··· * Requires all lines to end on a non-whitespac'\n'; |
| ✓ Was returned | /**··· * Requires all linefile.getLineBreaks()[0] || '\n'; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires all lines to end ocurrentLineNumber > 0) { |
| ✓ Was returned | /**··· * Requires!precedingToken && currentLineNumber > 0) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires all lines to end on a{ targetToken = file.getFirstToken({includeComments: true}); startLineNumber = 1; } else { |
| ✓ Negative was executed (else) | /**··· * Requires{ targetToken = file.getNextToken(precedingToken, { includeComments: true }); startLineNumber = precedingToken.loc.end.line; if (precedingToken.isComment && precedingToken.loc.start.line <= error.line && precedingToken.loc.end.line >= error.line) { if (precedingToken.type === 'Block') { if (ignoreEmptyLines) { var blockLines = precedingToken.value.split(/\r\n|\n|\r/); for (var k = 0; k < blockLines.length; k++) { if (!blockLines[k].match(/^\s*$/) || k === 0) { blockLines[k] = blockLines[k].split(/\s+$/).join(''); } } precedingToken.value = blockLines.join(linebreak); } else { precedingToken.value = precedingToken.value .split(/[^\S\r\n]+\r\n|[^\S\n]+\n|[^\S\r]+\r/) .join(linebreak); } } else { precedingToken.value = precedingToken.value.split(/\s+$/).join(''); } fixed = true; } } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires all lines to end on a non-whitespace charac{ if (precedingToken.type === 'Block') { if (ignoreEmptyLines) { var blockLines = precedingToken.value.split(/\r\n|\n|\r/); for (var k = 0; k < blockLines.length; k++) { if (!blockLines[k].match(/^\s*$/) || k === 0) { blockLines[k] = blockLines[k].split(/\s+$/).join(''); } } precedingToken.value = blockLines.join(linebreak); } else { precedingToken.value = precedingToken.value .split(/[^\S\r\n]+\r\n|[^\S\n]+\n|[^\S\r]+\r/) .join(linebreak); } } else { precedingToken.value = precedingToken.value.split(/\s+$/).join(''); } fixed = true; } |
| ✓ Negative was executed (else) | /**··· * Requir } |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires precedingToken.loc.end.line >= error.line) { |
| ✓ Was returned | /**··· * Requires precedingToken.isComment && precedingToken.loc.start.line <= error.line && |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires precedingToken.loc.start.line <= error.line && |
| ✓ Was returned | /**··· * Requires precedingToken.isComment && |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires all lines to end on a non-whitespace { if (ignoreEmptyLines) { var blockLines = precedingToken.value.split(/\r\n|\n|\r/); for (var k = 0; k < blockLines.length; k++) { if (!blockLines[k].match(/^\s*$/) || k === 0) { blockLines[k] = blockLines[k].split(/\s+$/).join(''); } } precedingToken.value = blockLines.join(linebreak); } else { precedingToken.value = precedingToken.value .split(/[^\S\r\n]+\r\n|[^\S\n]+\n|[^\S\r]+\r/) .join(linebreak); } } else { |
| ✓ Negative was executed (else) | /**··· * Requires all lin{ precedingToken.value = precedingToken.value.split(/\s+$/).join(''); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires all lines to end on a non-{ var blockLines = precedingToken.value.split(/\r\n|\n|\r/); for (var k = 0; k < blockLines.length; k++) { if (!blockLines[k].match(/^\s*$/) || k === 0) { blockLines[k] = blockLines[k].split(/\s+$/).join(''); } } precedingToken.value = blockLines.join(linebreak); } else { |
| ✓ Negative was executed (else) | /**··· * Requires all lines t{ precedingToken.value = precedingToken.value .split(/[^\S\r\n]+\r\n|[^\S\n]+\n|[^\S\r]+\r/) .join(linebreak); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires all lines to end on a non-whitespace character * * Types{ blockLines[k] = blockLines[k].split(/\s+$/).join(''); } |
| ✓ Negative was executed (else) | /**··· * Requires all lines to } |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires all lines to end on a non-whitespace character *k === 0) { |
| ✓ Was returned | /**··· * Requires all lines to end!blockLines[k].match(/^\s*$/) || k === 0) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires all lines to end on a non-wh{ var eolCount = targetToken.loc.start.line - startLineNumber + 1; var targetIndent = ''; var targetLine = lines[targetToken.loc.start.line - 1]; for (var j = 0, whitespace = targetLine.charAt(j); whitespace.match(/\s/); j++, whitespace = targetLine.charAt(j)) { targetIndent += whitespace; } file.setWhitespaceBefore(targetToken, new Array(eolCount).join(linebreak) + targetIndent); fixed = true; } |
| ✓ Negative was executed (else) | /**··· * Re if (!fixed && precedingToken && precedingToken.type === 'EOF') { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires all lines to end on !fixed) { |
| ✓ Was returned | /**··· * RequitargetToken !== null && !fixed) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires all lines to end on a non-whitespace character * * Ty{ precedingToken = file.getPrevToken(precedingToken, { includeWhitespace: true }); if (precedingToken.isWhitespace) { precedingToken.value = precedingToken.value.replace(/[^\S\n\r]$/g, ''); fixed = true; } } |
| ✓ Negative was executed (else) | /**··· * Re if (!fixed) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires all lines to end on a noprecedingToken.type === 'EOF') { |
| ✓ Was returned | /**··· * Requi!fixed && precedingToken && precedingToken.type === 'EOF') { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires all liprecedingToken && precedingToken.type === 'EOF') { |
| ✓ Was returned | /**··· * Requi!fixed && precedingToken && precedingToken.type === 'EOF') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires all lines to end on a non-whi{ precedingToken.value = precedingToken.value.replace(/[^\S\n\r]$/g, ''); fixed = true; } |
| ✗ Negative was not executed (else) | /**··· * Requir } |
| Branch IfStatement | |
|---|---|
| ✗ Positive was not executed (if) | /**··· * Requires all { error.fixed = false; } |
| ✓ Negative was executed (else) | /**··· * Re } |
| Function getUsedParams | |
|---|---|
| ✓ Was called | function getUsedParams(scope) {··· var vars; var res = []; if (scope.type === 'function-expression-name') { scope = scope.childScopes[0]; } var length = scope.block.params.length; for (var i = 0; i <= length; i++) { vars = scope.variables[i]; if (vars.name === 'arguments') { continue; } res.push({ param: vars, used: !!vars.references.length }); } var used = false; res.reverse().forEach(function(param) { if (used) { param.used = true; return; } if (param.used) { used = true; } }); return res.reverse(); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows unused params in function expressi{ scope = scope.childScopes[0]; } |
| ✓ Negative was executed (else) | /**··· var length = scope.block.params.length; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows unused params in funct{ continue; } |
| ✓ Negative was executed (else) | /**··· * Di res.push({ |
| Function (anonymous_704) | |
|---|---|
| ✓ Was called | /**··· * Disallows unused pafunction(param) { if (used) { param.used = true; return; } if (param.used) { used = true; } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows u{ param.used = true; return; } |
| ✓ Negative was executed (else) | /**··· * Di if (param.used) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows unused { used = true; } |
| ✓ Negative was executed (else) | /**··· * Di }); |
| Function (anonymous_705) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_706) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(options) { assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_707) | |
|---|---|
| ✓ Was called | /**··· * Disallows unfunction() { return 'disallowUnusedParams'; }, |
| Function (anonymous_708) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { file.iterateNodesByType(['FunctionDeclaration', 'FunctionExpression'], function(node) { var scope = file.getScope().acquire(node); var params = node.params; getUsedParams(scope).forEach(function(value, index) { if (value.used) { return; } var param = params[index]; errors.cast({ message: 'Param `' + value.param.name + '` is not used', line: param.loc.start.line, column: param.loc.start.column, additional: { node: param, token: file.getFirstNodeToken(param) } }); }); }); }, |
| Function (anonymous_709) | |
|---|---|
| ✓ Was called | /**··· * Disallows unused params in function expression and function declaration.function(node) { var scope = file.getScope().acquire(node); var params = node.params; getUsedParams(scope).forEach(function(value, index) { if (value.used) { return; } var param = params[index]; errors.cast({ message: 'Param `' + value.param.name + '` is not used', line: param.loc.start.line, column: param.loc.start.column, additional: { node: param, token: file.getFirstNodeToken(param) } }); }); }); |
| Function (anonymous_710) | |
|---|---|
| ✓ Was called | /**··· * Disallows unused params in functiofunction(value, index) { if (value.used) { return; } var param = params[index]; errors.cast({ message: 'Param `' + value.param.name + '` is not used', line: param.loc.start.line, column: param.loc.start.column, additional: { node: param, token: file.getFirstNodeToken(param) } }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows unused params i{ return; } |
| ✓ Negative was executed (else) | /**··· * Disallows var param = params[index]; |
| Function (anonymous_711) | |
|---|---|
| ✓ Was called | /**··· * Disfunction(file, error) { var node = error.additional.node; var parent = node.parentNode; var index = parent.params.indexOf(node); var length = parent.params.length; var token = error.additional.token; var next; if (parent.params[index + 1]) { next = file.findNextToken(token, 'Identifier'); } // For "b" // function test(b) {} if (length === 1) { file.removeToken(token); return; } // function test(a, b) {} if (length > 1 && index + 1 === length) { file.removeEntity(parent.params, node); var comma = file.findPrevToken(token, 'Punctuator', ','); file.setWhitespaceBefore(comma, ''); file.removeToken(comma); file.setWhitespaceBefore(token, ''); file.removeToken(token); return; } // function test(b, c) {} if (length > 1) { file.removeEntity(parent.params, node); file.removeToken(file.findNextToken(token, 'Punctuator', ',')); file.setWhitespaceBefore(next, ''); file.removeToken(token); return; } } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows unused params in func{ next = file.findNextToken(token, 'Identifier'); } |
| ✓ Negative was executed (else) | /**··· * Di // For "b" |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows unused pa{ file.removeToken(token); return; } |
| ✓ Negative was executed (else) | /**··· * Di // function test(a, b) {} |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows unused params in function expre{ file.removeEntity(parent.params, node); var comma = file.findPrevToken(token, 'Punctuator', ','); file.setWhitespaceBefore(comma, ''); file.removeToken(comma); file.setWhitespaceBefore(token, ''); file.removeToken(token); return; } |
| ✓ Negative was executed (else) | /**··· * Di // function test(b, c) {} |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows unused paindex + 1 === length) { |
| ✗ Was not returned | /**··· * Disallength > 1 && index + 1 === length) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows unused { file.removeEntity(parent.params, node); file.removeToken(file.findNextToken(token, 'Punctuator', ',')); file.setWhitespaceBefore(next, ''); file.removeToken(token); return; } |
| ✗ Negative was not executed (else) | /**··· * Di } |
| Function (anonymous_712) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() { }; |
| Function (anonymous_713) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(option) { assert(option === true, this.getOptionName() + ' requires a true value'); }, |
| Function (anonymous_714) | |
|---|---|
| ✓ Was called | /**··· * Disallows defunction() { return 'disallowVar'; }, |
| Function (anonymous_715) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { file.iterateNodesByType('VariableDeclaration', function(node) { for (var i = 0; i < node.declarations.length; i++) { var thisDeclaration = node.declarations[i]; if (thisDeclaration.parentNode.kind === 'var') { errors.add( 'Variable declarations should use `let` or `const` not `var`', node.loc.start ); } } }); } |
| Function (anonymous_716) | |
|---|---|
| ✓ Was called | /**··· * Disallows declaring variables with `var`. * * function(node) { for (var i = 0; i < node.declarations.length; i++) { var thisDeclaration = node.declarations[i]; if (thisDeclaration.parentNode.kind === 'var') { errors.add( 'Variable declarations should use `let` or `const` not `var`', node.loc.start ); } } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows declaring variables with `var`. * * Types: `{ errors.add( 'Variable declarations should use `let` or `const` not `var`', node.loc.start ); } |
| ✓ Negative was executed (else) | /**··· * Disallows } |
| Function (anonymous_717) | |
|---|---|
| ✓ Was called | /**··· * Requires tfunction() {}; |
| Function (anonymous_718) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(operators) { var isTrue = operators === true; assert( Array.isArray(operators) || isTrue, this.getOptionName() + ' option requires array or true value' ); if (isTrue) { operators = ['==', '===', '!=', '!==']; } this._operatorIndex = {}; for (var i = 0, l = operators.length; i < l; i++) { this._operatorIndex[operators[i]] = true; } }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires the variable to be the lisTrue, |
| ✓ Was returned | /**··· * RequiArray.isArray(operators) || isTrue, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires the { operators = ['==', '===', '!=', '!==']; } |
| ✓ Negative was executed (else) | /**··· * Re this._operatorIndex = {}; |
| Function (anonymous_719) | |
|---|---|
| ✓ Was called | /**··· * Requires thefunction() { return 'disallowYodaConditions'; }, |
| Function (anonymous_720) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var operators = this._operatorIndex; file.iterateNodesByType('BinaryExpression', function(node) { if (operators[node.operator]) { if (node.left.type === 'Literal' || (node.left.type === 'Identifier' && node.left.name === 'undefined') ) { errors.add('Yoda condition', node.left.loc.start); } } }); } |
| Function (anonymous_721) | |
|---|---|
| ✓ Was called | /**··· * Requires the variable to be the left hand opefunction(node) { if (operators[node.operator]) { if (node.left.type === 'Literal' || (node.left.type === 'Identifier' && node.left.name === 'undefined') ) { errors.add('Yoda condition', node.left.loc.start); } } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires the variable to be the lef{ if (node.left.type === 'Literal' || (node.left.type === 'Identifier' && node.left.name === 'undefined') ) { errors.add('Yoda condition', node.left.loc.start); } } |
| ✓ Negative was executed (else) | /**··· * Requir }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires th{ errors.add('Yoda condition', node.left.loc.start); } |
| ✓ Negative was executed (else) | /**··· * Requires t } |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires the vnode.left.type === 'Identifier' && node.left.name === 'undefined') |
| ✓ Was returned | /**··· * Requires the node.left.type === 'Literal' || |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires the variable to be the left hand operatonode.left.name === 'undefined') |
| ✓ Was returned | /**··· * Requires the vnode.left.type === 'Identifier' && node.left.name === 'undefined') |
| Function (anonymous_722) | |
|---|---|
| ✓ Was called | /**··· * Requires afunction() {}; |
| Function (anonymous_723) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(maximumLineLength) { this._tabSize = ''; this._allowRegex = false; this._allowComments = false; this._allowUrlComments = false; this._allowRequire = false; if (typeof maximumLineLength === 'object') { assert( typeof maximumLineLength.value === 'number', this.getOptionName() + ' option requires the "value" property to be defined' ); this._maximumLineLength = maximumLineLength.value; var tabSize = maximumLineLength.tabSize || 0; while (tabSize--) { this._tabSize += ' '; } var exceptions = maximumLineLength.allExcept || []; this._allowRegex = (exceptions.indexOf('regex') !== -1); this._allowComments = (exceptions.indexOf('comments') !== -1); this._allowUrlComments = (exceptions.indexOf('urlComments') !== -1); this._allowFunctionSignature = (exceptions.indexOf('functionSignature') !== -1); this._allowRequire = (exceptions.indexOf('require') !== -1); if (maximumLineLength.hasOwnProperty('allowRegex')) { this._allowRegex = (maximumLineLength.allowRegex === true); } if (maximumLineLength.hasOwnProperty('allowComments')) { this._allowComments = (maximumLineLength.allowComments === true); } if (maximumLineLength.hasOwnProperty('allowUrlComments')) { this._allowUrlComments = (maximumLineLength.allowUrlComments === true); } } else { assert( typeof maximumLineLength === 'number', this.getOptionName() + ' option requires number value or options object' ); this._maximumLineLength = maximumLineLength; } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires all lines to be at most the number { assert( typeof maximumLineLength.value === 'number', this.getOptionName() + ' option requires the "value" property to be defined' ); this._maximumLineLength = maximumLineLength.value; var tabSize = maximumLineLength.tabSize || 0; while (tabSize--) { this._tabSize += ' '; } var exceptions = maximumLineLength.allExcept || []; this._allowRegex = (exceptions.indexOf('regex') !== -1); this._allowComments = (exceptions.indexOf('comments') !== -1); this._allowUrlComments = (exceptions.indexOf('urlComments') !== -1); this._allowFunctionSignature = (exceptions.indexOf('functionSignature') !== -1); this._allowRequire = (exceptions.indexOf('require') !== -1); if (maximumLineLength.hasOwnProperty('allowRegex')) { this._allowRegex = (maximumLineLength.allowRegex === true); } if (maximumLineLength.hasOwnProperty('allowComments')) { this._allowComments = (maximumLineLength.allowComments === true); } if (maximumLineLength.hasOwnProperty('allowUrlComments')) { this._allowUrlComments = (maximumLineLength.allowUrlComments === true); } } else { |
| ✓ Negative was executed (else) | /**··· * Requires{ assert( typeof maximumLineLength === 'number', this.getOptionName() + ' option requires number value or options object' ); this._maximumLineLength = maximumLineLength; } |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires all lines to be at most the number of c0; |
| ✓ Was returned | /**··· * Requires all lines maximumLineLength.tabSize || 0; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires all lines to be at most the number of charac[]; |
| ✓ Was returned | /**··· * Requires all lines to maximumLineLength.allExcept || []; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires all lines to be at most the number of characters{ this._allowRegex = (maximumLineLength.allowRegex === true); } |
| ✓ Negative was executed (else) | /**··· * Requir if (maximumLineLength.hasOwnProperty('allowComments')) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires all lines to be at most the number of characters sp{ this._allowComments = (maximumLineLength.allowComments === true); } |
| ✓ Negative was executed (else) | /**··· * Requir if (maximumLineLength.hasOwnProperty('allowUrlComments')) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires all lines to be at most the number of characters speci{ this._allowUrlComments = (maximumLineLength.allowUrlComments === true); } |
| ✓ Negative was executed (else) | /**··· * Requir } else { |
| Function (anonymous_724) | |
|---|---|
| ✓ Was called | /**··· * Requires allfunction() { return 'maximumLineLength'; }, |
| Function (anonymous_725) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var maximumLineLength = this._maximumLineLength; var line; var lines = this._allowComments ? file.getLinesWithCommentsRemoved() : file.getLines(); // This check should not be destructive lines = lines.slice(); var removeLoc = function(tokenOrNode) { for (var i = tokenOrNode.loc.start.line; i <= tokenOrNode.loc.end.line; i++) { lines[i - 1] = ''; } }; if (this._allowRegex) { file.iterateTokensByType('RegularExpression', function(token) { removeLoc(token); }); } if (this._allowUrlComments) { file.iterateTokensByType(['Line', 'Block'], function(comment) { for (var i = comment.loc.start.line; i <= comment.loc.end.line; i++) { lines[i - 1] = lines[i - 1].replace(/(http|https|ftp):\/\/[^\s$]+/, ''); } }); } if (this._allowFunctionSignature) { file.iterateNodesByType('FunctionDeclaration', function(node) { removeLoc(node.id); node.params.forEach(removeLoc); }); file.iterateNodesByType('MethodDefinition', function(node) { removeLoc(node.key); }); file.iterateNodesByType(['ArrowFunctionExpression', 'FunctionExpression'], function(node) { // Need to remove the first line, because we can't be sure there's any id or params lines[node.loc.start.line - 1] = ''; if (node.id) { removeLoc(node.id); } node.params.forEach(removeLoc); }); } if (this._allowRequire) { file.iterateNodesByType('CallExpression', function(node) { if (node.callee.name === 'require') { removeLoc(node); } }); } for (var i = 0, l = lines.length; i < l; i++) { line = this._tabSize ? lines[i].replace(/\t/g, this._tabSize) : lines[i]; if (line.length > maximumLineLength) { errors.add( 'Line must be at most ' + maximumLineLength + ' characters', i + 1, lines[i].length ); } } } |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | /**··· * Requifile.getLinesWithCommentsRemoved() : file.getLines(); |
| ✓ Negative was returned (: ...) | /**··· * Requires all lines to be at most the numbefile.getLines(); |
| Function (anonymous_726) | |
|---|---|
| ✓ Was called | /**··· * Requires all linefunction(tokenOrNode) { for (var i = tokenOrNode.loc.start.line; i <= tokenOrNode.loc.end.line; i++) { lines[i - 1] = ''; } }; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires all lines to b{ file.iterateTokensByType('RegularExpression', function(token) { removeLoc(token); }); } |
| ✓ Negative was executed (else) | /**··· * Re if (this._allowUrlComments) { |
| Function (anonymous_727) | |
|---|---|
| ✓ Was called | /**··· * Requires all lines to be at most the number of charfunction(token) { removeLoc(token); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires all lines to be at m{ file.iterateTokensByType(['Line', 'Block'], function(comment) { for (var i = comment.loc.start.line; i <= comment.loc.end.line; i++) { lines[i - 1] = lines[i - 1].replace(/(http|https|ftp):\/\/[^\s$]+/, ''); } }); } |
| ✓ Negative was executed (else) | /**··· * Re if (this._allowFunctionSignature) { |
| Function (anonymous_728) | |
|---|---|
| ✓ Was called | /**··· * Requires all lines to be at most the number of chfunction(comment) { for (var i = comment.loc.start.line; i <= comment.loc.end.line; i++) { lines[i - 1] = lines[i - 1].replace(/(http|https|ftp):\/\/[^\s$]+/, ''); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires all lines to be at most th{ file.iterateNodesByType('FunctionDeclaration', function(node) { removeLoc(node.id); node.params.forEach(removeLoc); }); file.iterateNodesByType('MethodDefinition', function(node) { removeLoc(node.key); }); file.iterateNodesByType(['ArrowFunctionExpression', 'FunctionExpression'], function(node) { // Need to remove the first line, because we can't be sure there's any id or params lines[node.loc.start.line - 1] = ''; if (node.id) { removeLoc(node.id); } node.params.forEach(removeLoc); }); } |
| ✓ Negative was executed (else) | /**··· * Re if (this._allowRequire) { |
| Function (anonymous_729) | |
|---|---|
| ✓ Was called | /**··· * Requires all lines to be at most the number of charafunction(node) { removeLoc(node.id); node.params.forEach(removeLoc); }); |
| Function (anonymous_730) | |
|---|---|
| ✓ Was called | /**··· * Requires all lines to be at most the number of chfunction(node) { removeLoc(node.key); }); |
| Function (anonymous_731) | |
|---|---|
| ✓ Was called | /**··· * Requires all lines to be at most the number of characters specified * * Types:function(node) { // Need to remove the first line, because we can't be sure there's any id or params lines[node.loc.start.line - 1] = ''; if (node.id) { removeLoc(node.id); } node.params.forEach(removeLoc); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires all lines to { removeLoc(node.id); } |
| ✓ Negative was executed (else) | /**··· * Requires a node.params.forEach(removeLoc); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires all lines to be { file.iterateNodesByType('CallExpression', function(node) { if (node.callee.name === 'require') { removeLoc(node); } }); } |
| ✓ Negative was executed (else) | /**··· * Re for (var i = 0, l = lines.length; i < l; i++) { |
| Function (anonymous_732) | |
|---|---|
| ✓ Was called | /**··· * Requires all lines to be at most the number of function(node) { if (node.callee.name === 'require') { removeLoc(node); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires all lines to be at most the number o{ removeLoc(node); } |
| ✗ Negative was not executed (else) | /**··· * Requires a }); |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | /**··· * Requires all lines to be at lines[i].replace(/\t/g, this._tabSize) : lines[i]; |
| ✓ Negative was returned (: ...) | /**··· * Requires all lines to be at most the number of characters specified lines[i]; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires all lines to be at most the numbe{ errors.add( 'Line must be at most ' + maximumLineLength + ' characters', i + 1, lines[i].length ); } |
| ✓ Negative was executed (else) | /**··· * Requir } |
| Function (anonymous_733) | |
|---|---|
| ✓ Was called | /**··· * Requires tfunction() {}; |
| Function (anonymous_734) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { this._allowComments = true; if (typeof options === 'number') { assert( typeof options === 'number', this.getOptionName() + ' option requires number value or options object' ); this._maximumNumberOfLines = options; } else { assert( typeof options.value === 'number', this.getOptionName() + ' option requires the "value" property to be defined' ); this._maximumNumberOfLines = options.value; var exceptions = options.allExcept || []; this._allowComments = (exceptions.indexOf('comments') === -1); } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires the file to be at most th{ assert( typeof options === 'number', this.getOptionName() + ' option requires number value or options object' ); this._maximumNumberOfLines = options; } else { |
| ✓ Negative was executed (else) | /**··· * Requires{ assert( typeof options.value === 'number', this.getOptionName() + ' option requires the "value" property to be defined' ); this._maximumNumberOfLines = options.value; var exceptions = options.allExcept || []; this._allowComments = (exceptions.indexOf('comments') === -1); } |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires the file to be at most the number []; |
| ✓ Was returned | /**··· * Requires the file to boptions.allExcept || []; |
| Function (anonymous_735) | |
|---|---|
| ✓ Was called | /**··· * Requires thefunction() { return 'maximumNumberOfLines'; }, |
| Function (anonymous_736) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var firstToken = file.getFirstToken({includeComments: true}); var lines = this._allowComments ? file.getLines() : file.getLinesWithCommentsRemoved(); lines = lines.filter(function(line) {return line !== '';}); if (lines.length > this._maximumNumberOfLines) { errors.add('File must be at most ' + this._maximumNumberOfLines + ' lines long', firstToken.loc.end.line, firstToken.loc.end.column); } } |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | /**··· * Requirfile.getLines() : file.getLinesWithCommentsRemoved(); |
| ✓ Negative was returned (: ...) | /**··· * Requires the file to be file.getLinesWithCommentsRemoved(); |
| Function (anonymous_737) | |
|---|---|
| ✓ Was called | /**··· * Requires the file to bfunction(line) {return line !== '';}); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires the file to be at most the number of li{ errors.add('File must be at most ' + this._maximumNumberOfLines + ' lines long', firstToken.loc.end.line, firstToken.loc.end.column); } |
| ✓ Negative was executed (else) | /**··· * Re } |
| Function (anonymous_738) | |
|---|---|
| ✓ Was called | /**··· * Enforces ifunction() { }; |
| Function (anonymous_739) | |
|---|---|
| ✓ Was called | /**··· * Enforcesfunction(option) { if (typeof option === 'number') { this._indentationLevel = option; } else if (typeof option === 'string') { assert( option === 'firstParam', this.getOptionName() + ' option requires string value to be "firstParam"' ); this._alignWithFirstParam = true; } else if (option === true) { this._indentationLevel = 0; } else { assert( false, this.getOptionName() + ' option requires a valid option' ); } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Enforces indentation of parameter{ this._indentationLevel = option; } else if (typeof option === 'string') { |
| ✓ Negative was executed (else) | /**··· * Enforcesif (typeof option === 'string') { assert( option === 'firstParam', this.getOptionName() + ' option requires string value to be "firstParam"' ); this._alignWithFirstParam = true; } else if (option === true) { this._indentationLevel = 0; } else { assert( false, this.getOptionName() + ' option requires a valid option' ); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Enforces indentation of parameters in mu{ assert( option === 'firstParam', this.getOptionName() + ' option requires string value to be "firstParam"' ); this._alignWithFirstParam = true; } else if (option === true) { |
| ✓ Negative was executed (else) | /**··· * Enforcesif (option === true) { this._indentationLevel = 0; } else { assert( false, this.getOptionName() + ' option requires a valid option' ); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Enforces indentation of param{ this._indentationLevel = 0; } else { |
| ✓ Negative was executed (else) | /**··· * Enforces{ assert( false, this.getOptionName() + ' option requires a valid option' ); } |
| Function (anonymous_740) | |
|---|---|
| ✓ Was called | /**··· * Enforces indfunction() { return 'requireAlignedMultilineParams'; }, |
| Function (anonymous_741) | |
|---|---|
| ✓ Was called | /**··· * Enfofunction(file, errors) { var _this = this; file.iterateNodesByType(['FunctionDeclaration', 'FunctionExpression'], function(node) { var params = node.params; // We can pass the check if there's no params if (params.length === 0) { return; } var currentLine = params[0].loc.start.line; var referenceColumn; var body; if (_this._alignWithFirstParam) { referenceColumn = params[0].loc.start.column; } else { body = node.body.body[0]; // If function doesn't have a body just bail out (#1988) if (!body) { return; } referenceColumn = body.loc.start.column + _this._indentationLevel; } params.forEach(function(param) { if (param.loc.start.line !== currentLine) { if (param.loc.start.column !== referenceColumn) { errors.assert.indentation({ lineNumber: param.loc.start.line, actual: param.loc.start.column, expected: referenceColumn, indentChar: ' ', silent: false }); } currentLine = param.loc.start.line; } }); }); } |
| Function (anonymous_742) | |
|---|---|
| ✓ Was called | /**··· * Enforces indentation of parameters in multiline functions * * Types: `function(node) { var params = node.params; // We can pass the check if there's no params if (params.length === 0) { return; } var currentLine = params[0].loc.start.line; var referenceColumn; var body; if (_this._alignWithFirstParam) { referenceColumn = params[0].loc.start.column; } else { body = node.body.body[0]; // If function doesn't have a body just bail out (#1988) if (!body) { return; } referenceColumn = body.loc.start.column + _this._indentationLevel; } params.forEach(function(param) { if (param.loc.start.line !== currentLine) { if (param.loc.start.column !== referenceColumn) { errors.assert.indentation({ lineNumber: param.loc.start.line, actual: param.loc.start.column, expected: referenceColumn, indentChar: ' ', silent: false }); } currentLine = param.loc.start.line; } }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Enforces indentation of parame{ return; } |
| ✓ Negative was executed (else) | /**··· * Enforc var currentLine = params[0].loc.start.line; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Enforces indentation of parameters in{ referenceColumn = params[0].loc.start.column; } else { |
| ✓ Negative was executed (else) | /**··· * Enforces ind{ body = node.body.body[0]; // If function doesn't have a body just bail out (#1988) if (!body) { return; } referenceColumn = body.loc.start.column + _this._indentationLevel; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Enforces indentation{ return; } |
| ✓ Negative was executed (else) | /**··· * Enforces i referenceColumn = body.loc.start.column + _this._indentationLevel; |
| Function (anonymous_743) | |
|---|---|
| ✓ Was called | /**··· * Enforces indentationfunction(param) { if (param.loc.start.line !== currentLine) { if (param.loc.start.column !== referenceColumn) { errors.assert.indentation({ lineNumber: param.loc.start.line, actual: param.loc.start.column, expected: referenceColumn, indentChar: ' ', silent: false }); } currentLine = param.loc.start.line; } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Enforces indentation of parameters in multiline fun{ if (param.loc.start.column !== referenceColumn) { errors.assert.indentation({ lineNumber: param.loc.start.line, actual: param.loc.start.column, expected: referenceColumn, indentChar: ' ', silent: false }); } currentLine = param.loc.start.line; } |
| ✓ Negative was executed (else) | /**··· * Enforces i }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Enforces indentation of parameters in multiline functions * { errors.assert.indentation({ lineNumber: param.loc.start.line, actual: param.loc.start.column, expected: referenceColumn, indentChar: ' ', silent: false }); } |
| ✓ Negative was executed (else) | /**··· * Enforces inden currentLine = param.loc.start.line; |
| Function (anonymous_744) | |
|---|---|
| ✓ Was called | /**··· * Requires pfunction() {}; |
| Function (anonymous_745) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(mode) { var modes = { 'all': 'all', 'ignoreFunction': 'ignoreFunction', 'ignoreLineBreak': 'ignoreLineBreak', 'skipWithFunction': 'ignoreFunction', 'skipWithLineBreak': 'ignoreLineBreak' }; assert( typeof mode === 'string' && modes[mode], this.getOptionName() + ' requires one of the following values: ' + Object.keys(modes).join(', ') ); this._mode = modes[mode]; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires proper alignment in objemodes[mode], |
| ✗ Was not returned | /**··· * Requitypeof mode === 'string' && modes[mode], |
| Function (anonymous_746) | |
|---|---|
| ✓ Was called | /**··· * Requires profunction() { return 'requireAlignedObjectValues'; }, |
| Function (anonymous_747) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var mode = this._mode; file.iterateNodesByType('ObjectExpression', function(node) { if (node.loc.start.line === node.loc.end.line || node.properties < 2) { return; } var maxKeyEndPos = 0; var prevKeyEndPos = 0; var minColonPos = 0; var tokens = []; var skip = node.properties.some(function(property, index) { if (property.shorthand || property.method || property.kind !== 'init' || node.type === 'SpreadProperty') { return true; } if (mode === 'ignoreFunction' && property.value.type === 'FunctionExpression') { return true; } if (mode === 'ignoreLineBreak' && index > 0 && node.properties[index - 1].loc.end.line !== property.loc.start.line - 1) { return true; } prevKeyEndPos = maxKeyEndPos; maxKeyEndPos = Math.max(maxKeyEndPos, property.key.loc.end.column); var keyToken = file.getFirstNodeToken(property.key); if (property.computed === true) { while (keyToken.value !== ']') { keyToken = file.getNextToken(keyToken); } } var colon = file.getNextToken(keyToken); if (prevKeyEndPos < maxKeyEndPos) { minColonPos = colon.loc.start.column; } tokens.push({key: keyToken, colon: colon}); }); if (skip) { return; } var space = minColonPos - maxKeyEndPos; tokens.forEach(function(pair) { errors.assert.spacesBetween({ token: pair.key, nextToken: pair.colon, exactly: maxKeyEndPos - pair.key.loc.end.column + space, message: 'Alignment required' }); }); }); } |
| Function (anonymous_748) | |
|---|---|
| ✓ Was called | /**··· * Requires proper alignment in object literals.function(node) { if (node.loc.start.line === node.loc.end.line || node.properties < 2) { return; } var maxKeyEndPos = 0; var prevKeyEndPos = 0; var minColonPos = 0; var tokens = []; var skip = node.properties.some(function(property, index) { if (property.shorthand || property.method || property.kind !== 'init' || node.type === 'SpreadProperty') { return true; } if (mode === 'ignoreFunction' && property.value.type === 'FunctionExpression') { return true; } if (mode === 'ignoreLineBreak' && index > 0 && node.properties[index - 1].loc.end.line !== property.loc.start.line - 1) { return true; } prevKeyEndPos = maxKeyEndPos; maxKeyEndPos = Math.max(maxKeyEndPos, property.key.loc.end.column); var keyToken = file.getFirstNodeToken(property.key); if (property.computed === true) { while (keyToken.value !== ']') { keyToken = file.getNextToken(keyToken); } } var colon = file.getNextToken(keyToken); if (prevKeyEndPos < maxKeyEndPos) { minColonPos = colon.loc.start.column; } tokens.push({key: keyToken, colon: colon}); }); if (skip) { return; } var space = minColonPos - maxKeyEndPos; tokens.forEach(function(pair) { errors.assert.spacesBetween({ token: pair.key, nextToken: pair.colon, exactly: maxKeyEndPos - pair.key.loc.end.column + space, message: 'Alignment required' }); }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires proper alignment in object literals. * * Type: `String` * * Va{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir var maxKeyEndPos = 0; |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires proper alignment in object literals. * * Tynode.properties < 2) { |
| ✓ Was returned | /**··· * Requires node.loc.start.line === node.loc.end.line || node.properties < 2) { |
| Function (anonymous_749) | |
|---|---|
| ✓ Was called | /**··· * Requires proper alignment in object lfunction(property, index) { if (property.shorthand || property.method || property.kind !== 'init' || node.type === 'SpreadProperty') { return true; } if (mode === 'ignoreFunction' && property.value.type === 'FunctionExpression') { return true; } if (mode === 'ignoreLineBreak' && index > 0 && node.properties[index - 1].loc.end.line !== property.loc.start.line - 1) { return true; } prevKeyEndPos = maxKeyEndPos; maxKeyEndPos = Math.max(maxKeyEndPos, property.key.loc.end.column); var keyToken = file.getFirstNodeToken(property.key); if (property.computed === true) { while (keyToken.value !== ']') { keyToken = file.getNextToken(keyToken); } } var colon = file.getNextToken(keyToken); if (prevKeyEndPos < maxKeyEndPos) { minColonPos = colon.loc.start.column; } tokens.push({key: keyToken, colon: colon}); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires proper alignment in object literals.{ return true; } |
| ✓ Negative was executed (else) | /**··· * Requires p if (mode === 'ignoreFunction' && property.value.type === 'FunctionExpression') { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires propnode.type === 'SpreadProperty') { |
| ✓ Was returned | /**··· * Requires propproperty.shorthand || property.method || property.kind !== 'init' || |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires proper alignment in object literals. * * Typroperty.kind !== 'init' || |
| ✓ Was returned | /**··· * Requires propproperty.shorthand || property.method || property.kind !== 'init' || |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires proper alignment in objectproperty.method || property.kind !== 'init' || |
| ✓ Was returned | /**··· * Requires propproperty.shorthand || property.method || property.kind !== 'init' || |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires proper alignment in object literals. * * Type: `String` * * Values: * - `{ return true; } |
| ✓ Negative was executed (else) | /**··· * Requires p if (mode === 'ignoreLineBreak' && index > 0 && |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires proper alignment in object literaproperty.value.type === 'FunctionExpression') { |
| ✓ Was returned | /**··· * Requires propmode === 'ignoreFunction' && property.value.type === 'FunctionExpression') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires proper alignment in object literals. * * Type: `String` * * Values: * - { return true; } |
| ✓ Negative was executed (else) | /**··· * Requires p prevKeyEndPos = maxKeyEndPos; |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires propenode.properties[index - 1].loc.end.line !== property.loc.start.line - 1) { |
| ✓ Was returned | /**··· * Requires propmode === 'ignoreLineBreak' && index > 0 && |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires proper alignment in object literalindex > 0 && |
| ✓ Was returned | /**··· * Requires propmode === 'ignoreLineBreak' && index > 0 && |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires proper alignment in object liter{ while (keyToken.value !== ']') { keyToken = file.getNextToken(keyToken); } } |
| ✓ Negative was executed (else) | /**··· * Requires p var colon = file.getNextToken(keyToken); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires proper alignment in object literal{ minColonPos = colon.loc.start.column; } |
| ✓ Negative was executed (else) | /**··· * Requires p tokens.push({key: keyToken, colon: colon}); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires proper{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir var space = minColonPos - maxKeyEndPos; |
| Function (anonymous_750) | |
|---|---|
| ✓ Was called | /**··· * Requires proper aligfunction(pair) { errors.assert.spacesBetween({ token: pair.key, nextToken: pair.colon, exactly: maxKeyEndPos - pair.key.loc.end.column + space, message: 'Alignment required' }); }); |
| Function (anonymous_751) | |
|---|---|
| ✓ Was called | /**··· * Requires tfunction() {}; |
| Function (anonymous_752) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { var optionName = this.getOptionName(); if (typeof options === 'object') { assert(Array.isArray(options.allExcept), optionName + ' option requires "allExcept" to be an array'); assert(options.allExcept.length > 0, optionName + ' option requires "allExcept" to have at least one ' + ' item or be set to `true`'); this._exceptDeclarations = options.allExcept.indexOf('declarations') > -1; } else { assert(options === true, this.getOptionName() + ' option requires either a true value or an object'); } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires that a function expressio{ assert(Array.isArray(options.allExcept), optionName + ' option requires "allExcept" to be an array'); assert(options.allExcept.length > 0, optionName + ' option requires "allExcept" to have at least one ' + ' item or be set to `true`'); this._exceptDeclarations = options.allExcept.indexOf('declarations') > -1; } else { |
| ✓ Negative was executed (else) | /**··· * Requires{ assert(options === true, this.getOptionName() + ' option requires either a true value or an object'); } |
| Function (anonymous_753) | |
|---|---|
| ✓ Was called | /**··· * Requires thafunction() { return 'requireAnonymousFunctions'; }, |
| Function (anonymous_754) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var exceptDeclarations = this._exceptDeclarations; file.iterateNodesByType(['FunctionExpression', 'FunctionDeclaration'], function(node) { if (exceptDeclarations && node.type === 'FunctionDeclaration') { return; } if (node.id !== null) { errors.add('Functions must not be named', node.loc.start); } }); } |
| Function (anonymous_755) | |
|---|---|
| ✓ Was called | /**··· * Requires that a function expression be anonymous. * * Type: `Boolean` function(node) { if (exceptDeclarations && node.type === 'FunctionDeclaration') { return; } if (node.id !== null) { errors.add('Functions must not be named', node.loc.start); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires that a function expression be anonymous. * * Type: `Boole{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir if (node.id !== null) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires that a function expresnode.type === 'FunctionDeclaration') { |
| ✓ Was returned | /**··· * Requires exceptDeclarations && node.type === 'FunctionDeclaration') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires that a function ex{ errors.add('Functions must not be named', node.loc.start); } |
| ✓ Negative was executed (else) | /**··· * Requir }); |
| Function (anonymous_756) | |
|---|---|
| ✓ Was called | /**··· * Requires tfunction() {}; |
| Function (anonymous_757) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(option) { assert(option === true, this.getOptionName() + ' requires a true value'); }, |
| Function (anonymous_758) | |
|---|---|
| ✓ Was called | /**··· * Requires thafunction() { return 'requireArrayDestructuring'; }, |
| Function (anonymous_759) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { file.iterateNodesByType('VariableDeclaration', function(node) { node.declarations.forEach(function(declaration) { if (!declaration.init || declaration.init.type !== 'MemberExpression') { return; } var property = declaration.init.property || {}; if (property.type === 'Literal' && /^\d+$/.test(property.value)) { errors.add('Use array destructuring', property.loc.start); } }); }); } |
| Function (anonymous_760) | |
|---|---|
| ✓ Was called | /**··· * Requires that variable assignment from array valfunction(node) { node.declarations.forEach(function(declaration) { if (!declaration.init || declaration.init.type !== 'MemberExpression') { return; } var property = declaration.init.property || {}; if (property.type === 'Literal' && /^\d+$/.test(property.value)) { errors.add('Use array destructuring', property.loc.start); } }); }); |
| Function (anonymous_761) | |
|---|---|
| ✓ Was called | /**··· * Requires that variable assignmefunction(declaration) { if (!declaration.init || declaration.init.type !== 'MemberExpression') { return; } var property = declaration.init.property || {}; if (property.type === 'Literal' && /^\d+$/.test(property.value)) { errors.add('Use array destructuring', property.loc.start); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires that variable assignment from array values are * destructured. * * Ty{ return; } |
| ✓ Negative was executed (else) | /**··· * Requires t var property = declaration.init.property || {}; |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires that variable assignment declaration.init.type !== 'MemberExpression') { |
| ✗ Was not returned | /**··· * Requires that!declaration.init || declaration.init.type !== 'MemberExpression') { |
| Branch LogicalExpression | |
|---|---|
| ✗ Was not returned | /**··· * Requires that variable assignment from array values a{}; |
| ✓ Was returned | /**··· * Requires that variable adeclaration.init.property || {}; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires that variable assignment from array values are * destructured. *{ errors.add('Use array destructuring', property.loc.start); } |
| ✗ Negative was not executed (else) | /**··· * Requires t }); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires that variable assignment from array/^\d+$/.test(property.value)) { |
| ✗ Was not returned | /**··· * Requires thatproperty.type === 'Literal' && /^\d+$/.test(property.value)) { |
| Function (anonymous_762) | |
|---|---|
| ✓ Was called | /**··· * Requires tfunction() {}; |
| Function (anonymous_763) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_764) | |
|---|---|
| ✓ Was called | /**··· * Requires thafunction() { return 'requireArrowFunctions'; }, |
| Function (anonymous_765) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { function isCallback(node) { return node.type === 'FunctionExpression' && node.parentNode.type === 'CallExpression'; } function isFunctionBindWithThis(node) { return node.callee && node.callee.type === 'MemberExpression' && node.callee.object.type === 'FunctionExpression' && node.callee.property.type === 'Identifier' && node.callee.property.name === 'bind' && node.arguments && node.arguments.length === 1 && node.arguments[0].type === 'ThisExpression'; } file.iterateNodesByType(['FunctionExpression', 'CallExpression'], function(node) { if (isCallback(node) || isFunctionBindWithThis(node)) { errors.add('Use arrow functions instead of function expressions', node.loc.start); } }); } |
| Function isCallback | |
|---|---|
| ✓ Was called | /**··· * Rfunction isCallback(node) { return node.type === 'FunctionExpression' && node.parentNode.type === 'CallExpression'; } |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires that arrow functions are used instead of node.parentNode.type === 'CallExpression'; |
| ✓ Was returned | /**··· * Requires thanode.type === 'FunctionExpression' && node.parentNode.type === 'CallExpression'; |
| Function isFunctionBindWithThis | |
|---|---|
| ✓ Was called | /**··· * Rfunction isFunctionBindWithThis(node) { return node.callee && node.callee.type === 'MemberExpression' && node.callee.object.type === 'FunctionExpression' && node.callee.property.type === 'Identifier' && node.callee.property.name === 'bind' && node.arguments && node.arguments.length === 1 && node.arguments[0].type === 'ThisExpression'; } |
| Branch LogicalExpression | |
|---|---|
| ✗ Was not returned | /**··· * Requires that arrow functions are usnode.arguments[0].type === 'ThisExpression'; |
| ✓ Was returned | /**··· * Requires thanode.callee && node.callee.type === 'MemberExpression' && node.callee.object.type === 'FunctionExpression' && node.callee.property.type === 'Identifier' && node.callee.property.name === 'bind' && node.arguments && node.arguments.length === 1 && node.arguments[0].type === 'ThisExpression'; |
| Branch LogicalExpression | |
| ✗ Was not returned | /**··· * Requinode.arguments.length === 1 && node.arguments[0].type === 'ThisExpression'; |
| ✓ Was returned | /**··· * Requires thanode.callee && node.callee.type === 'MemberExpression' && node.callee.object.type === 'FunctionExpression' && node.callee.property.type === 'Identifier' && node.callee.property.name === 'bind' && node.arguments && |
| Branch LogicalExpression | |
| ✗ Was not returned | /**··· * Requinode.arguments && |
| ✓ Was returned | /**··· * Requires thanode.callee && node.callee.type === 'MemberExpression' && node.callee.object.type === 'FunctionExpression' && node.callee.property.type === 'Identifier' && node.callee.property.name === 'bind' && |
| Branch LogicalExpression | |
| ✗ Was not returned | /**··· * Requinode.callee.property.name === 'bind' && |
| ✓ Was returned | /**··· * Requires thanode.callee && node.callee.type === 'MemberExpression' && node.callee.object.type === 'FunctionExpression' && node.callee.property.type === 'Identifier' && |
| Branch LogicalExpression | |
| ✗ Was not returned | /**··· * Requinode.callee.property.type === 'Identifier' && |
| ✓ Was returned | /**··· * Requires thanode.callee && node.callee.type === 'MemberExpression' && node.callee.object.type === 'FunctionExpression' && |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requinode.callee.object.type === 'FunctionExpression' && |
| ✓ Was returned | /**··· * Requires thanode.callee && node.callee.type === 'MemberExpression' && |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requinode.callee.type === 'MemberExpression' && |
| ✓ Was returned | /**··· * Requires thanode.callee && |
| Function (anonymous_768) | |
|---|---|
| ✓ Was called | /**··· * Requires that arrow functions are used instead of anonymous functiofunction(node) { if (isCallback(node) || isFunctionBindWithThis(node)) { errors.add('Use arrow functions instead of function expressions', node.loc.start); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires that arrow functions are used instead of anonymous{ errors.add('Use arrow functions instead of function expressions', node.loc.start); } |
| ✓ Negative was executed (else) | /**··· * Requir }); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires that arrow functionsisFunctionBindWithThis(node)) { |
| ✓ Was returned | /**··· * Requires isCallback(node) || isFunctionBindWithThis(node)) { |
| Function hasCommentInBlock | |
|---|---|
| ✓ Was called | function hasCommentInBlock(block, commentTokens) {··· var count; var comment; for (count = 0; count < commentTokens.length; count++) { comment = commentTokens[count]; if (comment.range[0] >= block.range[0] && comment.range[1] <= block.range[1]) { return true; } } return false; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires blocks to begin and end with a n{ return true; } |
| ✓ Negative was executed (else) | /**··· * Re } |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requicomment.range[1] <= block.range[1]) { |
| ✓ Was returned | /**··· * Requicomment.range[0] >= block.range[0] && |
| Function (anonymous_770) | |
|---|---|
| ✓ Was called | /**··· * Requires bfunction() {}; |
| Function (anonymous_771) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { var optionType = typeof options; assert( options === true || optionType === 'number' || optionType === 'object', this.getOptionName() + ' option requires the value true, an Integer or an object' ); this._minLines = 0; this._includeComments = false; if (optionType === 'number') { this._minLines = options; } else if (optionType === 'object') { assert( options.includeComments === true, this.getOptionName() + ' option requires includeComments property to be true for object' ); this._includeComments = options.includeComments; if (options.hasOwnProperty('minLines')) { assert( typeof options.minLines === 'number', this.getOptionName() + ' option requires minLines property to be an integer for object' ); this._minLines = options.minLines; } } assert( this._minLines >= 0, this.getOptionName() + ' option requires minimum statements setting to be >= 0' ); }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires blocks to begin and end with a newline * optionType === 'object', |
| ✓ Was returned | /**··· * Requioptions === true || optionType === 'number' || optionType === 'object', |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires blocks to begin optionType === 'number' || optionType === 'object', |
| ✓ Was returned | /**··· * Requioptions === true || optionType === 'number' || optionType === 'object', |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires blocks to begin and e{ this._minLines = options; } else if (optionType === 'object') { |
| ✓ Negative was executed (else) | /**··· * Requiresif (optionType === 'object') { assert( options.includeComments === true, this.getOptionName() + ' option requires includeComments property to be true for object' ); this._includeComments = options.includeComments; if (options.hasOwnProperty('minLines')) { assert( typeof options.minLines === 'number', this.getOptionName() + ' option requires minLines property to be an integer for object' ); this._minLines = options.minLines; } } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires blocks to begin and end with{ assert( options.includeComments === true, this.getOptionName() + ' option requires includeComments property to be true for object' ); this._includeComments = options.includeComments; if (options.hasOwnProperty('minLines')) { assert( typeof options.minLines === 'number', this.getOptionName() + ' option requires minLines property to be an integer for object' ); this._minLines = options.minLines; } } |
| ✓ Negative was executed (else) | /**··· * Re assert( |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires blocks to begin and end with a newli{ assert( typeof options.minLines === 'number', this.getOptionName() + ' option requires minLines property to be an integer for object' ); this._minLines = options.minLines; } |
| ✓ Negative was executed (else) | /**··· * Requir } |
| Function (anonymous_772) | |
|---|---|
| ✓ Was called | /**··· * Requires blofunction() { return 'requireBlocksOnNewline'; }, |
| Function (anonymous_773) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var minLines = this._minLines; var includeComments = this._includeComments; var commentTokens = []; file.iterateTokensByType(['Line', 'Block'], function(commentToken) { commentTokens.push(commentToken); }); file.iterateNodesByType('BlockStatement', function(node) { var hasComment = false; if (includeComments === true) { hasComment = hasCommentInBlock(node, commentTokens); } if (hasComment === false && node.body.length <= minLines) { return; } var openingBracket = file.getFirstNodeToken(node); var nextToken = file.getNextToken(openingBracket, { includeComments: includeComments }); errors.assert.differentLine({ token: openingBracket, nextToken: nextToken, message: 'Missing newline after opening curly brace' }); var closingBracket = file.getLastNodeToken(node); var prevToken = file.getPrevToken(closingBracket, { includeComments: includeComments }); errors.assert.differentLine({ token: prevToken, nextToken: closingBracket, message: 'Missing newline before closing curly brace' }); }); } |
| Function (anonymous_774) | |
|---|---|
| ✓ Was called | /**··· * Requires blocks to begin and end with a newlifunction(commentToken) { commentTokens.push(commentToken); }); |
| Function (anonymous_775) | |
|---|---|
| ✓ Was called | /**··· * Requires blocks to begin and end with a newfunction(node) { var hasComment = false; if (includeComments === true) { hasComment = hasCommentInBlock(node, commentTokens); } if (hasComment === false && node.body.length <= minLines) { return; } var openingBracket = file.getFirstNodeToken(node); var nextToken = file.getNextToken(openingBracket, { includeComments: includeComments }); errors.assert.differentLine({ token: openingBracket, nextToken: nextToken, message: 'Missing newline after opening curly brace' }); var closingBracket = file.getLastNodeToken(node); var prevToken = file.getPrevToken(closingBracket, { includeComments: includeComments }); errors.assert.differentLine({ token: prevToken, nextToken: closingBracket, message: 'Missing newline before closing curly brace' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires blocks to begin and end wi{ hasComment = hasCommentInBlock(node, commentTokens); } |
| ✓ Negative was executed (else) | /**··· * Requir if (hasComment === false && node.body.length <= minLines) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires blocks to begin and end with a newline * * Types: `B{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir var openingBracket = file.getFirstNodeToken(node); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires blocks to begin and end node.body.length <= minLines) { |
| ✓ Was returned | /**··· * Requires hasComment === false && node.body.length <= minLines) { |
| Function processArrayOfStringOrRegExp | |
|---|---|
| ✓ Was called | function processArrayOfStringOrRegExp(iv) {··· if (!Array.isArray(iv)) { return; } var rv = []; var i = 0; while (rv && (i < iv.length)) { var elt = iv[i]; if (typeof elt === 'string') { // string values OK rv.push(elt); } else if (elt instanceof RegExp) { // existing RegExp OK rv.push(elt); } else if (elt && (typeof elt === 'object')) { try { // ESTree RegExpLiteral ok if it produces RegExp rv.push(new RegExp(elt.regex.pattern, elt.regex.flags || '')); } catch (e) { // Not a valid RegExpLiteral rv = null; } } else { // Unknown value rv = null; } ++i; } return rv; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires identifiers { return; } |
| ✓ Negative was executed (else) | /**··· var rv = []; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires idi < iv.length)) { |
| ✓ Was returned | /**··· * Requrv && (i < iv.length)) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires identifiers to be cam{ // string values OK rv.push(elt); } else if (elt instanceof RegExp) { |
| ✓ Negative was executed (else) | /**··· * Requiresif (elt instanceof RegExp) { // existing RegExp OK rv.push(elt); } else if (elt && (typeof elt === 'object')) { try { // ESTree RegExpLiteral ok if it produces RegExp rv.push(new RegExp(elt.regex.pattern, elt.regex.flags || '')); } catch (e) { // Not a valid RegExpLiteral rv = null; } } else { // Unknown value rv = null; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires identifiers to be camelCas{ // existing RegExp OK rv.push(elt); } else if (elt && (typeof elt === 'object')) { |
| ✓ Negative was executed (else) | /**··· * Requiresif (elt && (typeof elt === 'object')) { try { // ESTree RegExpLiteral ok if it produces RegExp rv.push(new RegExp(elt.regex.pattern, elt.regex.flags || '')); } catch (e) { // Not a valid RegExpLiteral rv = null; } } else { // Unknown value rv = null; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires identifiers to be camelCased or UPPER{ try { // ESTree RegExpLiteral ok if it produces RegExp rv.push(new RegExp(elt.regex.pattern, elt.regex.flags || '')); } catch (e) { // Not a valid RegExpLiteral rv = null; } } else { |
| ✓ Negative was executed (else) | /**··· * Requires{ // Unknown value rv = null; } |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires identifierstypeof elt === 'object')) { |
| ✓ Was returned | /**··· * Requires ideelt && (typeof elt === 'object')) { |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires identifiers to be camelCased or UPPERCASE_WITH_UNDERSCORE'')); |
| ✓ Was returned | /**··· * Requires identifiers to be camelCased or UPPERCelt.regex.flags || '')); |
| Function startAfterStringPrefix | |
|---|---|
| ✓ Was called | function startAfterStringPrefix(value, prefix) {··· var start = prefix.length; if (start >= value.length) { return; } if (value.substr(0, prefix.length) !== prefix) { return; } return start; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires identifiers to { return; } |
| ✓ Negative was executed (else) | /**··· if (value.substr(0, prefix.length) !== prefix) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires identifiers to be camelCased or UPP{ return; } |
| ✓ Negative was executed (else) | /**··· return start; |
| Function startAfterRegExpPrefix | |
|---|---|
| ✓ Was called | function startAfterRegExpPrefix(value, prefix) {··· var match = prefix.exec(value); if (!match) { return; } if (match.index !== 0) { return; } return match[0].length; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires { return; } |
| ✓ Negative was executed (else) | /**··· if (match.index !== 0) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires identifiers{ return; } |
| ✓ Negative was executed (else) | /**··· return match[0].length; |
| Function endBeforeStringSuffix | |
|---|---|
| ✓ Was called | function endBeforeStringSuffix(value, suffix) {··· var ends = value.length - suffix.length; if (ends <= 0) { return; } if (value.substr(ends) !== suffix) { return; } return ends; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires ide{ return; } |
| ✓ Negative was executed (else) | /**··· if (value.substr(ends) !== suffix) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires identifiers to be camel{ return; } |
| ✓ Negative was executed (else) | /**··· return ends; |
| Function endBeforeRegExpSuffix | |
|---|---|
| ✓ Was called | function endBeforeRegExpSuffix(value, suffix) {··· var match = suffix.exec(value); if (!match) { return; } var ends = match.index; if ((ends + match[0].length) !== value.length) { return; } return ends; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires { return; } |
| ✓ Negative was executed (else) | /**··· var ends = match.index; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires identifiers to be camelCased or UPP{ return; } |
| ✓ Negative was executed (else) | /**··· return ends; |
| Function matchException | |
|---|---|
| ✓ Was called | function matchException(value, exception) {··· if (typeof exception === 'string') { return (exception === value); } return exception.test(value); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires identifiers to be camelC{ return (exception === value); } |
| ✓ Negative was executed (else) | /**··· return exception.test(value); |
| Function (anonymous_782) | |
|---|---|
| ✓ Was called | /**··· * Requires ifunction() {}; |
| Function (anonymous_783) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { if (typeof options !== 'object') { assert( options === true || options === 'ignoreProperties', this.getOptionName() + ' option requires a true value or `ignoreProperties`' ); var _options = { ignoreProperties: options === 'ignoreProperties' ? true : false, strict: false }; return this.configure(_options); } assert( !options.hasOwnProperty('ignoreProperties') || typeof options.ignoreProperties === 'boolean', this.getOptionName() + ' option should have boolean value for ignoreProperties' ); this._ignoreProperties = options.ignoreProperties; assert( !options.hasOwnProperty('strict') || typeof options.strict === 'boolean', this.getOptionName() + ' option should have boolean value for strict' ); this._strict = options.strict; var asre = processArrayOfStringOrRegExp(options.allowedPrefixes); assert( !options.hasOwnProperty('allowedPrefixes') || asre, this.getOptionName() + ' option should have array of string or RegExp for allowedPrefixes' ); if (asre) { this._allowedPrefixes = asre; } asre = processArrayOfStringOrRegExp(options.allowedSuffixes); assert( !options.hasOwnProperty('allowedSuffixes') || asre, this.getOptionName() + ' option should have array of string or RegExp for allowedSuffixes' ); if (asre) { this._allowedSuffixes = asre; } asre = processArrayOfStringOrRegExp(options.allExcept); assert( !options.hasOwnProperty('allExcept') || asre, this.getOptionName() + ' option should have array of string or RegExp for allExcept' ); if (asre) { this._allExcept = asre; } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires identifiers to be camelCa{ assert( options === true || options === 'ignoreProperties', this.getOptionName() + ' option requires a true value or `ignoreProperties`' ); var _options = { ignoreProperties: options === 'ignoreProperties' ? true : false, strict: false }; return this.configure(_options); } |
| ✓ Negative was executed (else) | /**··· * Re assert( |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires identifiers to be options === 'ignoreProperties', |
| ✓ Was returned | /**··· * Requireoptions === true || options === 'ignoreProperties', |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | /**··· * Requires identifiers to be camelCased or UPPERCASE_WITH_UNDEtrue : false, |
| ✓ Negative was returned (: ...) | /**··· * Requires identifiers to be camelCased or UPPERCASE_WITH_UNDERSCORESfalse, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires identifiers to be camelCased or UPPERCASEtypeof options.ignoreProperties === 'boolean', |
| ✓ Was returned | /**··· * Req!options.hasOwnProperty('ignoreProperties') || typeof options.ignoreProperties === 'boolean', |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires identifiers to be camelCased ortypeof options.strict === 'boolean', |
| ✓ Was returned | /**··· * Req!options.hasOwnProperty('strict') || typeof options.strict === 'boolean', |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires identifiers to be camelCased or UPPERCASasre, |
| ✓ Was returned | /**··· * Req!options.hasOwnProperty('allowedPrefixes') || asre, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires id{ this._allowedPrefixes = asre; } |
| ✓ Negative was executed (else) | /**··· * Re asre = processArrayOfStringOrRegExp(options.allowedSuffixes); |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires identifiers to be camelCased or UPPERCASasre, |
| ✓ Was returned | /**··· * Req!options.hasOwnProperty('allowedSuffixes') || asre, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires id{ this._allowedSuffixes = asre; } |
| ✓ Negative was executed (else) | /**··· * Re asre = processArrayOfStringOrRegExp(options.allExcept); |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires identifiers to be camelCased or UPasre, |
| ✓ Was returned | /**··· * Req!options.hasOwnProperty('allExcept') || asre, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires id{ this._allExcept = asre; } |
| ✓ Negative was executed (else) | /**··· * Re }, |
| Function (anonymous_784) | |
|---|---|
| ✓ Was called | /**··· * Requires idefunction() { return 'requireCamelCaseOrUpperCaseIdentifiers'; }, |
| Function (anonymous_785) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { file.iterateTokensByType('Identifier', function(token) { var value = token.value; // Leading and trailing underscores signify visibility/scope and do not affect // validation of the rule. Remove them to simplify the checks. var isPrivate = (value[0] === '_'); value = value.replace(/^_+|_+$/g, ''); // Detect exceptions before stripping prefixes/suffixes. if (this._allExcept) { for (i = 0, len = this._allExcept.length; i < len; ++i) { if (matchException(value, this._allExcept[i])) { return; } } } // Strip at most one prefix permitted text from the identifier. This transformation // cannot change an acceptable identifier into an unacceptable identifier so we can // continue with the normal verification of whatever it produces. var i; var len; if (this._allowedPrefixes) { for (i = 0, len = this._allowedPrefixes.length; i < len; ++i) { var prefix = this._allowedPrefixes[i]; var start; if (typeof prefix === 'string') { start = startAfterStringPrefix(value, prefix); } else { start = startAfterRegExpPrefix(value, prefix); } if (start !== undefined) { value = value.substr(start); break; } } } // As with prefix but for one suffix permitted text. if (this._allowedSuffixes) { for (i = 0, len = this._allowedSuffixes.length; i < len; ++i) { var suffix = this._allowedSuffixes[i]; var ends; if (typeof suffix === 'string') { ends = endBeforeStringSuffix(value, suffix); } else { ends = endBeforeRegExpSuffix(value, suffix); } if (ends !== undefined) { value = value.substr(0, ends); break; } } } if (value.indexOf('_') === -1 || value.toUpperCase() === value) { if (!this._strict) {return;} if (value.length === 0 || value[0].toUpperCase() !== value[0] || isPrivate) { return; } } if (this._ignoreProperties) { var nextToken = file.getNextToken(token); var prevToken = file.getPrevToken(token); if (nextToken && nextToken.value === ':') { return; } /* This enables an identifier to be snake cased via the object * destructuring pattern. We must check to see if the identifier * is being used to set values into an object to determine if * this is a legal assignment. * Example: ({camelCase: snake_case}) => camelCase.length */ if (prevToken && prevToken.value === ':') { var node = file.getNodeByRange(token.range[0]); var parentNode = node.parentNode; if (parentNode && parentNode.type === 'Property') { var grandpa = parentNode.parentNode; if (grandpa && grandpa.type === 'ObjectPattern') { return; } } } if (prevToken && (prevToken.value === '.' || prevToken.value === 'get' || prevToken.value === 'set')) { return; } } errors.add( 'All identifiers must be camelCase or UPPER_CASE', token.loc.start.line, token.loc.start.column ); }.bind(this)); } |
| Function (anonymous_786) | |
|---|---|
| ✓ Was called | /**··· * Requires identifiers to be camelCased orfunction(token) { var value = token.value; // Leading and trailing underscores signify visibility/scope and do not affect // validation of the rule. Remove them to simplify the checks. var isPrivate = (value[0] === '_'); value = value.replace(/^_+|_+$/g, ''); // Detect exceptions before stripping prefixes/suffixes. if (this._allExcept) { for (i = 0, len = this._allExcept.length; i < len; ++i) { if (matchException(value, this._allExcept[i])) { return; } } } // Strip at most one prefix permitted text from the identifier. This transformation // cannot change an acceptable identifier into an unacceptable identifier so we can // continue with the normal verification of whatever it produces. var i; var len; if (this._allowedPrefixes) { for (i = 0, len = this._allowedPrefixes.length; i < len; ++i) { var prefix = this._allowedPrefixes[i]; var start; if (typeof prefix === 'string') { start = startAfterStringPrefix(value, prefix); } else { start = startAfterRegExpPrefix(value, prefix); } if (start !== undefined) { value = value.substr(start); break; } } } // As with prefix but for one suffix permitted text. if (this._allowedSuffixes) { for (i = 0, len = this._allowedSuffixes.length; i < len; ++i) { var suffix = this._allowedSuffixes[i]; var ends; if (typeof suffix === 'string') { ends = endBeforeStringSuffix(value, suffix); } else { ends = endBeforeRegExpSuffix(value, suffix); } if (ends !== undefined) { value = value.substr(0, ends); break; } } } if (value.indexOf('_') === -1 || value.toUpperCase() === value) { if (!this._strict) {return;} if (value.length === 0 || value[0].toUpperCase() !== value[0] || isPrivate) { return; } } if (this._ignoreProperties) { var nextToken = file.getNextToken(token); var prevToken = file.getPrevToken(token); if (nextToken && nextToken.value === ':') { return; } /* This enables an identifier to be snake cased via the object * destructuring pattern. We must check to see if the identifier * is being used to set values into an object to determine if * this is a legal assignment. * Example: ({camelCase: snake_case}) => camelCase.length */ if (prevToken && prevToken.value === ':') { var node = file.getNodeByRange(token.range[0]); var parentNode = node.parentNode; if (parentNode && parentNode.type === 'Property') { var grandpa = parentNode.parentNode; if (grandpa && grandpa.type === 'ObjectPattern') { return; } } } if (prevToken && (prevToken.value === '.' || prevToken.value === 'get' || prevToken.value === 'set')) { return; } } errors.add( 'All identifiers must be camelCase or UPPER_CASE', token.loc.start.line, token.loc.start.column ); }.bind(this)); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires identifiers to be{ for (i = 0, len = this._allExcept.length; i < len; ++i) { if (matchException(value, this._allExcept[i])) { return; } } } |
| ✓ Negative was executed (else) | /**··· * Requir // Strip at most one prefix permitted text from the identifier. This transformation |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires identifiers to be camelCased or UPPERCASE_WITH_UNDE{ return; } |
| ✓ Negative was executed (else) | /**··· * Requires ident } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires identifiers to be camel{ for (i = 0, len = this._allowedPrefixes.length; i < len; ++i) { var prefix = this._allowedPrefixes[i]; var start; if (typeof prefix === 'string') { start = startAfterStringPrefix(value, prefix); } else { start = startAfterRegExpPrefix(value, prefix); } if (start !== undefined) { value = value.substr(start); break; } } } |
| ✓ Negative was executed (else) | /**··· * Requir // As with prefix but for one suffix permitted text. |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires identifiers to be camelCased or UPPE{ start = startAfterStringPrefix(value, prefix); } else { |
| ✓ Negative was executed (else) | /**··· * Requires identifiers{ start = startAfterRegExpPrefix(value, prefix); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires identifiers to be camelCased { value = value.substr(start); break; } |
| ✓ Negative was executed (else) | /**··· * Requires ident } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires identifiers to be camel{ for (i = 0, len = this._allowedSuffixes.length; i < len; ++i) { var suffix = this._allowedSuffixes[i]; var ends; if (typeof suffix === 'string') { ends = endBeforeStringSuffix(value, suffix); } else { ends = endBeforeRegExpSuffix(value, suffix); } if (ends !== undefined) { value = value.substr(0, ends); break; } } } |
| ✓ Negative was executed (else) | /**··· * Requir if (value.indexOf('_') === -1 || value.toUpperCase() === value) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires identifiers to be camelCased or UPPE{ ends = endBeforeStringSuffix(value, suffix); } else { |
| ✓ Negative was executed (else) | /**··· * Requires identifiers{ ends = endBeforeRegExpSuffix(value, suffix); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires identifiers to be camelCased{ value = value.substr(0, ends); break; } |
| ✓ Negative was executed (else) | /**··· * Requires ident } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires identifiers to be camelCased or UPPERCASE_WITH_UNDERSCORES { if (!this._strict) {return;} if (value.length === 0 || value[0].toUpperCase() !== value[0] || isPrivate) { return; } } |
| ✓ Negative was executed (else) | /**··· * Requir if (this._ignoreProperties) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires identifiers to be camelCased value.toUpperCase() === value) { |
| ✓ Was returned | /**··· * Requires value.indexOf('_') === -1 || value.toUpperCase() === value) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires identifiers to be c{return;} |
| ✓ Negative was executed (else) | /**··· * Requires identifiers to be camelCased if (value.length === 0 || value[0].toUpperCase() !== value[0] || isPrivate) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires identifiers to be camelCased or UPPERCASE_WITH_UNDERSCORES * * Types: `Boo{ return; } |
| ✓ Negative was executed (else) | /**··· * Requires i } |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires identifiers to be camelCased or UPPERCASE_WITH_UNDERSCORES * * isPrivate) { |
| ✓ Was returned | /**··· * Requires idenvalue.length === 0 || value[0].toUpperCase() !== value[0] || isPrivate) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires identifiers to be camelCasvalue[0].toUpperCase() !== value[0] || isPrivate) { |
| ✓ Was returned | /**··· * Requires idenvalue.length === 0 || value[0].toUpperCase() !== value[0] || isPrivate) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires identifiers to be camelC{ var nextToken = file.getNextToken(token); var prevToken = file.getPrevToken(token); if (nextToken && nextToken.value === ':') { return; } /* This enables an identifier to be snake cased via the object * destructuring pattern. We must check to see if the identifier * is being used to set values into an object to determine if * this is a legal assignment. * Example: ({camelCase: snake_case}) => camelCase.length */ if (prevToken && prevToken.value === ':') { var node = file.getNodeByRange(token.range[0]); var parentNode = node.parentNode; if (parentNode && parentNode.type === 'Property') { var grandpa = parentNode.parentNode; if (grandpa && grandpa.type === 'ObjectPattern') { return; } } } if (prevToken && (prevToken.value === '.' || prevToken.value === 'get' || prevToken.value === 'set')) { return; } } |
| ✓ Negative was executed (else) | /**··· * Requir errors.add( |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires identifiers to be camelCased or UPPERCASE_{ return; } |
| ✓ Negative was executed (else) | /**··· * Requires i /* This enables an identifier to be snake cased via the object |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires identifiers to benextToken.value === ':') { |
| ✗ Was not returned | /**··· * Requires idennextToken && nextToken.value === ':') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires identifiers to be camelCased or UPPERCASE_{ var node = file.getNodeByRange(token.range[0]); var parentNode = node.parentNode; if (parentNode && parentNode.type === 'Property') { var grandpa = parentNode.parentNode; if (grandpa && grandpa.type === 'ObjectPattern') { return; } } } |
| ✓ Negative was executed (else) | /**··· * Requires i if (prevToken && (prevToken.value === '.' || |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires identifiers to beprevToken.value === ':') { |
| ✓ Was returned | /**··· * Requires idenprevToken && prevToken.value === ':') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires identifiers to be camelCased or UPPERCASE_WITH_UNDERSC{ var grandpa = parentNode.parentNode; if (grandpa && grandpa.type === 'ObjectPattern') { return; } } |
| ✗ Negative was not executed (else) | /**··· * Requires ident } |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires identifiers to be cameparentNode.type === 'Property') { |
| ✗ Was not returned | /**··· * Requires identifiparentNode && parentNode.type === 'Property') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires identifiers to be camelCased or UPPERCASE_WITH_UNDERSCORE{ return; } |
| ✗ Negative was not executed (else) | /**··· * Requires identifie } |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires identifiers to be camelgrandpa.type === 'ObjectPattern') { |
| ✗ Was not returned | /**··· * Requires identifiers grandpa && grandpa.type === 'ObjectPattern') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires identifiers to be camelCased or UPPERCASE_WITH_UNDERSCORES *{ return; } |
| ✓ Negative was executed (else) | /**··· * Requires i } |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires identifiers to be prevToken.value === '.' || prevToken.value === 'get' || prevToken.value === 'set')) { |
| ✓ Was returned | /**··· * Requires idenprevToken && (prevToken.value === '.' || |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires identifiers to be camelCased or UprevToken.value === 'set')) { |
| ✓ Was returned | /**··· * Requires identifiers to be prevToken.value === '.' || prevToken.value === 'get' || prevToken.value === 'set')) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires idenprevToken.value === 'get' || prevToken.value === 'set')) { |
| ✓ Was returned | /**··· * Requires identifiers to be prevToken.value === '.' || |
| Function (anonymous_787) | |
|---|---|
| ✓ Was called | /**··· * Requires tfunction() {}; |
| Function (anonymous_788) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { var exceptions; this.inlined = false; this._isPragma = null; var optionName = this.getOptionName(); var isObject = typeof options === 'object'; var error = optionName + ' option requires a true value ' + 'or an object with String[] `allExcept` property or true with `inlined`'; assert( options === true || isObject, error ); if (isObject && options.allExcept) { exceptions = options.allExcept; // verify items in `allExcept` property in object are string values assert( Array.isArray(exceptions) && exceptions.every(function(el) { return typeof el === 'string'; }), 'Property `allExcept` in ' + optionName + ' should be an array of strings' ); this._isPragma = isPragma(exceptions); } if (!this._isPragma) { this._isPragma = isPragma(); } if (isObject && options.inlined) { this.inlined = true; } if (isObject && !options.allExcept && !options.inlined) { assert(false, error); } }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * RequiisObject, |
| ✓ Was returned | /**··· * Requioptions === true || |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires the first alphabetical char{ exceptions = options.allExcept; // verify items in `allExcept` property in object are string values assert( Array.isArray(exceptions) && exceptions.every(function(el) { return typeof el === 'string'; }), 'Property `allExcept` in ' + optionName + ' should be an array of strings' ); this._isPragma = isPragma(exceptions); } |
| ✓ Negative was executed (else) | /**··· * Re if (!this._isPragma) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires the firsoptions.allExcept) { |
| ✓ Was returned | /**··· * RequiisObject && options.allExcept) { |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires exceptions.every(function(el) { return typeof el === 'string'; }), |
| ✗ Was not returned | /**··· * Requires Array.isArray(exceptions) && |
| Function (anonymous_789) | |
|---|---|
| ✓ Was called | /**··· * Requires the first alphabefunction(el) { return typeof el === 'string'; }), |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires the first alp{ this._isPragma = isPragma(); } |
| ✓ Negative was executed (else) | /**··· * Re if (isObject && options.inlined) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires the first alphabetical ch{ this.inlined = true; } |
| ✓ Negative was executed (else) | /**··· * Re if (isObject && !options.allExcept && !options.inlined) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires the firsoptions.inlined) { |
| ✓ Was returned | /**··· * RequiisObject && options.inlined) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires the first alphabetical character of a comment to{ assert(false, error); } |
| ✓ Negative was executed (else) | /**··· * Re }, |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires the first alphabetical charact!options.inlined) { |
| ✓ Was returned | /**··· * RequiisObject && !options.allExcept && !options.inlined) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires the firs!options.allExcept && !options.inlined) { |
| ✓ Was returned | /**··· * RequiisObject && !options.allExcept && !options.inlined) { |
| Function (anonymous_790) | |
|---|---|
| ✓ Was called | /**··· * Requires thefunction() { return 'requireCapitalizedComments'; }, |
| Function (anonymous_791) | |
|---|---|
| ✓ Was called | /**··· * Requifunction(comment) { var protocolParts = comment.value.split('://'); if (protocolParts.length === 1) { return false; } return comment.value.indexOf(protocolParts[0]) === 0; }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires the first alphabetical c{ return false; } |
| ✓ Negative was executed (else) | /**··· * Re return comment.value.indexOf(protocolParts[0]) === 0; |
| Function (anonymous_792) | |
|---|---|
| ✓ Was called | /**··· * Requires thfunction(comment) { return this._isPragma(comment.value); }, |
| Function (anonymous_793) | |
|---|---|
| ✓ Was called | /**··· * Requirefunction(comment) { var first = this._getFirstChar(comment); return first && upperCasePattern.test(first); }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires the firsupperCasePattern.test(first); |
| ✗ Was not returned | /**··· * Requiresfirst && upperCasePattern.test(first); |
| Function (anonymous_794) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(comment) { var first = this._getFirstChar(comment); return first && letterPattern.test(first); }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires the firsletterPattern.test(first); |
| ✓ Was returned | /**··· * Requiresfirst && letterPattern.test(first); |
| Function (anonymous_795) | |
|---|---|
| ✓ Was called | /**··· * Requires thefunction(comment) { return comment.value.replace(/[\n\s\*]/g, '')[0]; }, |
| Function (anonymous_796) | |
|---|---|
| ✓ Was called | /**··· * Requires thfunction(comment, file) { var prevComment = file.getPrevToken(comment, {includeComments: true}); if (prevComment) { return prevComment.type === 'Line' && prevComment.loc.start.line + 1 === comment.loc.start.line && prevComment.value.trim().length > 0; } return false; }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires the first{ return prevComment.type === 'Line' && prevComment.loc.start.line + 1 === comment.loc.start.line && prevComment.value.trim().length > 0; } |
| ✓ Negative was executed (else) | /**··· * Re return false; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires prevComment.value.trim().length > 0; |
| ✓ Was returned | /**··· * Requires theprevComment.type === 'Line' && prevComment.loc.start.line + 1 === comment.loc.start.line && |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires prevComment.loc.start.line + 1 === comment.loc.start.line && |
| ✓ Was returned | /**··· * Requires theprevComment.type === 'Line' && |
| Function (anonymous_797) | |
|---|---|
| ✓ Was called | /**··· * Requires the first alphabfunction(file, comment) { if (!this.inlined) { return false; } var firstToken = file.getFirstNodeToken(comment); var otherToken = file.getPrevToken(firstToken, { includeComments: true }); return otherToken ? otherToken.loc.start.line === firstToken.loc.start.line : false; }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires the first a{ return false; } |
| ✓ Negative was executed (else) | /**··· * Re var firstToken = file.getFirstNodeToken(comment); |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | /**··· * Requires the first alotherToken.loc.start.line === firstToken.loc.start.line : false; |
| ✓ Negative was returned (: ...) | /**··· * Requires the first alphabetical character of a comment to be uppercase, unless false; |
| Function (anonymous_798) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var _this = this; function add(comment) { errors.cast({ message: 'Comments must start with an uppercase letter, unless it is part of a textblock', line: comment.loc.start.line, column: comment.loc.start.column, additional: comment }); } file.iterateTokensByType('Line', function(comment) { if (_this._isException(comment)) { return; } if (_this._isUrl(comment)) { return; } if (!_this._isLetter(comment)) { return; } if (_this._isTextBlock(comment, file)) { return; } if (_this._isValid(comment)) { return; } add(comment); }); file.iterateTokensByType('Block', function(comment) { if (_this._isException(comment)) { return; } if (_this._isUrl(comment)) { return; } if (!_this._isLetter(comment)) { return; } if (_this._shouldIgnoreIfInTheMiddle(file, comment)) { return; } if (_this._isValid(comment)) { return; } add(comment); }); }, |
| Function add | |
|---|---|
| ✓ Was called | /**··· * Rfunction add(comment) { errors.cast({ message: 'Comments must start with an uppercase letter, unless it is part of a textblock', line: comment.loc.start.line, column: comment.loc.start.column, additional: comment }); } |
| Function (anonymous_800) | |
|---|---|
| ✓ Was called | /**··· * Requires the first alphabetical chfunction(comment) { if (_this._isException(comment)) { return; } if (_this._isUrl(comment)) { return; } if (!_this._isLetter(comment)) { return; } if (_this._isTextBlock(comment, file)) { return; } if (_this._isValid(comment)) { return; } add(comment); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires the first alphabetical charac{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir if (_this._isUrl(comment)) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires the first alphabetical { return; } |
| ✓ Negative was executed (else) | /**··· * Requir if (!_this._isLetter(comment)) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires the first alphabetical char{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir if (_this._isTextBlock(comment, file)) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires the first alphabetical character of{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir if (_this._isValid(comment)) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires the first alphabetical ch{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir add(comment); |
| Function (anonymous_801) | |
|---|---|
| ✓ Was called | /**··· * Requires the first alphabetical chafunction(comment) { if (_this._isException(comment)) { return; } if (_this._isUrl(comment)) { return; } if (!_this._isLetter(comment)) { return; } if (_this._shouldIgnoreIfInTheMiddle(file, comment)) { return; } if (_this._isValid(comment)) { return; } add(comment); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires the first alphabetical charac{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir if (_this._isUrl(comment)) { |
| Branch IfStatement | |
|---|---|
| ✗ Positive was not executed (if) | /**··· * Requires the first alphabetical { return; } |
| ✓ Negative was executed (else) | /**··· * Requir if (!_this._isLetter(comment)) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires the first alphabetical char{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir if (_this._shouldIgnoreIfInTheMiddle(file, comment)) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires the first alphabetical character of a comment to { return; } |
| ✓ Negative was executed (else) | /**··· * Requir if (_this._isValid(comment)) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires the first alphabetical ch{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir add(comment); |
| Function (anonymous_802) | |
|---|---|
| ✓ Was called | /**··· * Reqfunction(file, error) { var comment = error.additional; var first = this._getFirstChar(comment); comment.value = comment.value.replace(first, first.toUpperCase()); } |
| Function (anonymous_803) | |
|---|---|
| ✓ Was called | /**··· * Requires cfunction() {}; |
| Function (anonymous_804) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { assert( options === true || Array.isArray(options.allExcept), this.getOptionName() + ' option requires a true value or an object of exceptions' ); this._allowedConstructors = {}; var allExcept = options.allExcept; if (allExcept) { for (var i = 0, l = allExcept.length; i < l; i++) { this._allowedConstructors[allExcept[i]] = true; } } }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires capitalized consArray.isArray(options.allExcept), |
| ✓ Was returned | /**··· * Requioptions === true || Array.isArray(options.allExcept), |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires capital{ for (var i = 0, l = allExcept.length; i < l; i++) { this._allowedConstructors[allExcept[i]] = true; } } |
| ✓ Negative was executed (else) | /**··· * Re }, |
| Function (anonymous_805) | |
|---|---|
| ✓ Was called | /**··· * Requires capfunction() { return 'requireCapitalizedConstructorsNew'; }, |
| Function (anonymous_806) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var allowedConstructors = this._allowedConstructors; file.iterateNodesByType('CallExpression', function(node) { if (node.callee.type === 'Identifier' && !allowedConstructors[node.callee.name] && node.callee.name[0].toLowerCase() !== node.callee.name[0] ) { errors.add( 'Constructor functions should use the "new" keyword', node.callee.loc.start.line, node.callee.loc.start.column ); } }); } |
| Function (anonymous_807) | |
|---|---|
| ✓ Was called | /**··· * Requires capitalized constructors to to usefunction(node) { if (node.callee.type === 'Identifier' && !allowedConstructors[node.callee.name] && node.callee.name[0].toLowerCase() !== node.callee.name[0] ) { errors.add( 'Constructor functions should use the "new" keyword', node.callee.loc.start.line, node.callee.loc.start.column ); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Require{ errors.add( 'Constructor functions should use the "new" keyword', node.callee.loc.start.line, node.callee.loc.start.column ); } |
| ✓ Negative was executed (else) | /**··· * Requir }); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires node.callee.name[0].toLowerCase() !== node.callee.name[0] |
| ✓ Was returned | /**··· * Requires node.callee.type === 'Identifier' && !allowedConstructors[node.callee.name] && |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires !allowedConstructors[node.callee.name] && |
| ✓ Was returned | /**··· * Requires node.callee.type === 'Identifier' && |
| Function (anonymous_808) | |
|---|---|
| ✓ Was called | /**··· * Requires cfunction() {}; |
| Function (anonymous_809) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { assert( options === true || Array.isArray(options.allExcept), this.getOptionName() + ' option requires a true value or an object of exceptions' ); this._allowedConstructors = {}; var allExcept = options.allExcept; if (allExcept) { for (var i = 0, l = allExcept.length; i < l; i++) { this._allowedConstructors[allExcept[i]] = true; } } }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires constructors to Array.isArray(options.allExcept), |
| ✓ Was returned | /**··· * Requioptions === true || Array.isArray(options.allExcept), |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires constru{ for (var i = 0, l = allExcept.length; i < l; i++) { this._allowedConstructors[allExcept[i]] = true; } } |
| ✓ Negative was executed (else) | /**··· * Re }, |
| Function (anonymous_810) | |
|---|---|
| ✓ Was called | /**··· * Requires confunction() { return 'requireCapitalizedConstructors'; }, |
| Function (anonymous_811) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var allowedConstructors = this._allowedConstructors; file.iterateNodesByType('NewExpression', function(node) { if (node.callee.type === 'Identifier' && !allowedConstructors[node.callee.name] && node.callee.name[0].toUpperCase() !== node.callee.name[0] ) { errors.add( 'Constructor functions should be capitalized', node.callee.loc.start.line, node.callee.loc.start.column ); } }); } |
| Function (anonymous_812) | |
|---|---|
| ✓ Was called | /**··· * Requires constructors to be capitalized (efunction(node) { if (node.callee.type === 'Identifier' && !allowedConstructors[node.callee.name] && node.callee.name[0].toUpperCase() !== node.callee.name[0] ) { errors.add( 'Constructor functions should be capitalized', node.callee.loc.start.line, node.callee.loc.start.column ); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Require{ errors.add( 'Constructor functions should be capitalized', node.callee.loc.start.line, node.callee.loc.start.column ); } |
| ✓ Negative was executed (else) | /**··· * Requir }); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires node.callee.name[0].toUpperCase() !== node.callee.name[0] |
| ✓ Was returned | /**··· * Requires node.callee.type === 'Identifier' && !allowedConstructors[node.callee.name] && |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires !allowedConstructors[node.callee.name] && |
| ✓ Was returned | /**··· * Requires node.callee.type === 'Identifier' && |
| Function (anonymous_813) | |
|---|---|
| ✓ Was called | /**··· * Requires cfunction() {}; |
| Function (anonymous_814) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_815) | |
|---|---|
| ✓ Was called | /**··· * Requires comfunction() { return 'requireCommaBeforeLineBreak'; }, |
| Function (anonymous_816) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { file.iterateTokensByTypeAndValue('Punctuator', ',', function(token) { var prevToken = file.getPrevToken(token); if (prevToken.value === ',') { return; } errors.assert.sameLine({ token: prevToken, nextToken: token, message: 'Commas should not be placed on new line' }); }); } |
| Function (anonymous_817) | |
|---|---|
| ✓ Was called | /**··· * Requires commas as last token on a line in lists. * function(token) { var prevToken = file.getPrevToken(token); if (prevToken.value === ',') { return; } errors.assert.sameLine({ token: prevToken, nextToken: token, message: 'Commas should not be placed on new line' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires commas as last token on a{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir errors.assert.sameLine({ |
| Function (anonymous_818) | |
|---|---|
| ✓ Was called | /**··· * Requires cfunction() {}; |
| Function (anonymous_819) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { assert( Array.isArray(options) || options === true || typeof options === 'object', this.getOptionName() + ' option requires array, true value, or object' ); var keywordMap = { 'return': 'ReturnStatement', 'break': 'BreakStatement', 'continue': 'ContinueStatement' }; if (options === true) { options = defaultKeywords; } if (!Array.isArray(options)) { assert( Array.isArray(options.allExcept), this.getOptionName() + '.allExcept ' + 'property requires an array value' ); assert( Array.isArray(options.keywords) || options.keywords === true, this.getOptionName() + '.keywords ' + 'property requires an array value or a value of true' ); if (options.keywords === true) { options.keywords = defaultKeywords; } this._exceptions = options.allExcept.map(function(statementType) { return keywordMap[statementType]; }); options = options.keywords; } this._typeIndex = {}; for (var i = 0, l = options.length; i < l; i++) { this._typeIndex[options[i]] = true; } }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires curly braces after statements. * * Typestypeof options === 'object', |
| ✓ Was returned | /**··· * RequiArray.isArray(options) || options === true || typeof options === 'object', |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires curly braces after staoptions === true || typeof options === 'object', |
| ✓ Was returned | /**··· * RequiArray.isArray(options) || options === true || typeof options === 'object', |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires curly braces a{ options = defaultKeywords; } |
| ✓ Negative was executed (else) | /**··· * Re if (!Array.isArray(options)) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires curly braces after st{ assert( Array.isArray(options.allExcept), this.getOptionName() + '.allExcept ' + 'property requires an array value' ); assert( Array.isArray(options.keywords) || options.keywords === true, this.getOptionName() + '.keywords ' + 'property requires an array value or a value of true' ); if (options.keywords === true) { options.keywords = defaultKeywords; } this._exceptions = options.allExcept.map(function(statementType) { return keywordMap[statementType]; }); options = options.keywords; } |
| ✓ Negative was executed (else) | /**··· * Re this._typeIndex = {}; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires curly braces after statements. * options.keywords === true, |
| ✓ Was returned | /**··· * Requires Array.isArray(options.keywords) || options.keywords === true, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires curly braces after statemen{ options.keywords = defaultKeywords; } |
| ✓ Negative was executed (else) | /**··· * Requir this._exceptions = options.allExcept.map(function(statementType) { |
| Function (anonymous_820) | |
|---|---|
| ✓ Was called | /**··· * Requires curly braces after statements. * * function(statementType) { return keywordMap[statementType]; }); |
| Function (anonymous_821) | |
|---|---|
| ✓ Was called | /**··· * Requires curfunction() { return 'requireCurlyBraces'; }, |
| Function (anonymous_822) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var typeIndex = this._typeIndex; var exceptions = this._exceptions; function isNotABlockStatement(node) { return node && node.type !== 'BlockStatement'; } function addError(typeString, entity) { errors.add( typeString + ' statement without curly braces', entity.loc.start.line, entity.loc.start.column ); } function checkBody(type, typeString) { file.iterateNodesByType(type, function(node) { if (isNotABlockStatement(node.body)) { addError(typeString, node); } }); } if (typeIndex.if || typeIndex.else) { file.iterateNodesByType('IfStatement', function(node) { if (typeIndex.if && isNotABlockStatement(node.consequent) && // check exceptions for if and else !(exceptions && exceptions.indexOf(node.consequent.type) !== -1)) { addError('If', node); } if (typeIndex.else && isNotABlockStatement(node.alternate) && node.alternate.type !== 'IfStatement' && // check exceptions for if and else !(exceptions && exceptions.indexOf(node.consequent.type) !== -1)) { addError('Else', file.getPrevToken(file.getFirstNodeToken(node.alternate))); } }); } if (typeIndex.case || typeIndex.default) { file.iterateNodesByType('SwitchCase', function(node) { // empty case statement if (node.consequent.length === 0) { return; } if (node.consequent.length === 1 && node.consequent[0].type === 'BlockStatement') { return; } if (node.test === null && typeIndex.default) { addError('Default', node); } if (node.test !== null && typeIndex.case) { addError('Case', node); } }); } if (typeIndex.while) { checkBody('WhileStatement', 'While'); } if (typeIndex.for) { checkBody('ForStatement', 'For'); checkBody('ForInStatement', 'For in'); checkBody('ForOfStatement', 'For of'); } if (typeIndex.do) { checkBody('DoWhileStatement', 'Do while'); } if (typeIndex.with) { checkBody('WithStatement', 'With'); } } |
| Function isNotABlockStatement | |
|---|---|
| ✓ Was called | /**··· * Rfunction isNotABlockStatement(node) { return node && node.type !== 'BlockStatement'; } |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires curly bracenode.type !== 'BlockStatement'; |
| ✓ Was returned | /**··· * Requires curnode && node.type !== 'BlockStatement'; |
| Function addError | |
|---|---|
| ✓ Was called | /**··· * Rfunction addError(typeString, entity) { errors.add( typeString + ' statement without curly braces', entity.loc.start.line, entity.loc.start.column ); } |
| Function checkBody | |
|---|---|
| ✓ Was called | /**··· * Rfunction checkBody(type, typeString) { file.iterateNodesByType(type, function(node) { if (isNotABlockStatement(node.body)) { addError(typeString, node); } }); } |
| Function (anonymous_826) | |
|---|---|
| ✓ Was called | /**··· * Requires curly braces after statemefunction(node) { if (isNotABlockStatement(node.body)) { addError(typeString, node); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires curly braces after statements. * * { addError(typeString, node); } |
| ✓ Negative was executed (else) | /**··· * Requires c }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires curly braces after statement{ file.iterateNodesByType('IfStatement', function(node) { if (typeIndex.if && isNotABlockStatement(node.consequent) && // check exceptions for if and else !(exceptions && exceptions.indexOf(node.consequent.type) !== -1)) { addError('If', node); } if (typeIndex.else && isNotABlockStatement(node.alternate) && node.alternate.type !== 'IfStatement' && // check exceptions for if and else !(exceptions && exceptions.indexOf(node.consequent.type) !== -1)) { addError('Else', file.getPrevToken(file.getFirstNodeToken(node.alternate))); } }); } |
| ✓ Negative was executed (else) | /**··· * Re if (typeIndex.case || typeIndex.default) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires curly bracestypeIndex.else) { |
| ✓ Was returned | /**··· * RequitypeIndex.if || typeIndex.else) { |
| Function (anonymous_827) | |
|---|---|
| ✓ Was called | /**··· * Requires curly braces after statements. * function(node) { if (typeIndex.if && isNotABlockStatement(node.consequent) && // check exceptions for if and else !(exceptions && exceptions.indexOf(node.consequent.type) !== -1)) { addError('If', node); } if (typeIndex.else && isNotABlockStatement(node.alternate) && node.alternate.type !== 'IfStatement' && // check exceptions for if and else !(exceptions && exceptions.indexOf(node.consequent.type) !== -1)) { addError('Else', file.getPrevToken(file.getFirstNodeToken(node.alternate))); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires curly braces after statements. * * Types: `Array` or `Boolean` or `O{ addError('If', node); } |
| ✓ Negative was executed (else) | /**··· * Requires c if (typeIndex.else && isNotABlockStatement(node.alternate) && |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires curl!(exceptions && exceptions.indexOf(node.consequent.type) !== -1)) { |
| ✓ Was returned | /**··· * Requires curltypeIndex.if && isNotABlockStatement(node.consequent) && |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires curly braces after sisNotABlockStatement(node.consequent) && |
| ✓ Was returned | /**··· * Requires curltypeIndex.if && isNotABlockStatement(node.consequent) && |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires curly braces after sexceptions.indexOf(node.consequent.type) !== -1)) { |
| ✓ Was returned | /**··· * Requires curly exceptions && exceptions.indexOf(node.consequent.type) !== -1)) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires curly braces after statements. * * Types: `Array` or `Boolean` or `O{ addError('Else', file.getPrevToken(file.getFirstNodeToken(node.alternate))); } |
| ✓ Negative was executed (else) | /**··· * Requires c }); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires curl!(exceptions && exceptions.indexOf(node.consequent.type) !== -1)) { |
| ✓ Was returned | /**··· * Requires curltypeIndex.else && isNotABlockStatement(node.alternate) && node.alternate.type !== 'IfStatement' && |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires curlnode.alternate.type !== 'IfStatement' && |
| ✓ Was returned | /**··· * Requires curltypeIndex.else && isNotABlockStatement(node.alternate) && |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires curly braces after staisNotABlockStatement(node.alternate) && |
| ✓ Was returned | /**··· * Requires curltypeIndex.else && isNotABlockStatement(node.alternate) && |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires curly braces after sexceptions.indexOf(node.consequent.type) !== -1)) { |
| ✓ Was returned | /**··· * Requires curly exceptions && exceptions.indexOf(node.consequent.type) !== -1)) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires curly braces after statements. *{ file.iterateNodesByType('SwitchCase', function(node) { // empty case statement if (node.consequent.length === 0) { return; } if (node.consequent.length === 1 && node.consequent[0].type === 'BlockStatement') { return; } if (node.test === null && typeIndex.default) { addError('Default', node); } if (node.test !== null && typeIndex.case) { addError('Case', node); } }); } |
| ✓ Negative was executed (else) | /**··· * Re if (typeIndex.while) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires curly braces atypeIndex.default) { |
| ✓ Was returned | /**··· * RequitypeIndex.case || typeIndex.default) { |
| Function (anonymous_828) | |
|---|---|
| ✓ Was called | /**··· * Requires curly braces after statements. * function(node) { // empty case statement if (node.consequent.length === 0) { return; } if (node.consequent.length === 1 && node.consequent[0].type === 'BlockStatement') { return; } if (node.test === null && typeIndex.default) { addError('Default', node); } if (node.test !== null && typeIndex.case) { addError('Case', node); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires curly braces after statements. * { return; } |
| ✓ Negative was executed (else) | /**··· * Requires c if (node.consequent.length === 1 && node.consequent[0].type === 'BlockStatement') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires curly braces after statements. * * Types: `Array` or `Boolean` or `Object` * *{ return; } |
| ✓ Negative was executed (else) | /**··· * Requires c if (node.test === null && typeIndex.default) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires curly braces after statements. * *node.consequent[0].type === 'BlockStatement') { |
| ✓ Was returned | /**··· * Requires curlnode.consequent.length === 1 && node.consequent[0].type === 'BlockStatement') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires curly braces after statements. * * Types: `{ addError('Default', node); } |
| ✓ Negative was executed (else) | /**··· * Requires c if (node.test !== null && typeIndex.case) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires curly braces after statemetypeIndex.default) { |
| ✓ Was returned | /**··· * Requires curlnode.test === null && typeIndex.default) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires curly braces after statements. * * Types{ addError('Case', node); } |
| ✓ Negative was executed (else) | /**··· * Requires c }); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires curly braces after statemetypeIndex.case) { |
| ✓ Was returned | /**··· * Requires curlnode.test !== null && typeIndex.case) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires curly braces { checkBody('WhileStatement', 'While'); } |
| ✓ Negative was executed (else) | /**··· * Re if (typeIndex.for) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires curly brace{ checkBody('ForStatement', 'For'); checkBody('ForInStatement', 'For in'); checkBody('ForOfStatement', 'For of'); } |
| ✓ Negative was executed (else) | /**··· * Re if (typeIndex.do) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires curly brac{ checkBody('DoWhileStatement', 'Do while'); } |
| ✓ Negative was executed (else) | /**··· * Re if (typeIndex.with) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires curly braces{ checkBody('WithStatement', 'With'); } |
| ✓ Negative was executed (else) | /**··· * Re } |
| Function (anonymous_829) | |
|---|---|
| ✓ Was called | /**··· * Require a function() {}; |
| Function (anonymous_830) | |
|---|---|
| ✓ Was called | /**··· * Require function(options) { assert( options === true || options === 'ignoreProperties', this.getOptionName() + ' option requires true or "ignoreProperties" value, or should be removed' ); this._ignoreProperties = (options === 'ignoreProperties'); }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Require a $ before variaboptions === 'ignoreProperties', |
| ✓ Was returned | /**··· * Requioptions === true || options === 'ignoreProperties', |
| Function (anonymous_831) | |
|---|---|
| ✓ Was called | /**··· * Require a $ function() { return 'requireDollarBeforejQueryAssignment'; }, |
| Function (anonymous_832) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var ignoreProperties = this._ignoreProperties; file.iterateNodesByType(['VariableDeclarator', 'AssignmentExpression', 'ObjectExpression'], function(token) { var type = token.type; var left; var varName; var right; function checkIfVarNameShouldStartWithDollar(varName, left, right) { if (/^_?\$/.test(varName)) { return; } if (!right || right.type !== 'CallExpression') { return; } var nextToken = file.getTokenByRangeStart(right.callee.range[0]); if (nextToken.value !== '$') { return; } nextToken = file.getNextToken(nextToken); if (nextToken.value !== '(') { return; } while (!(nextToken.type === 'Punctuator' && nextToken.value === ')')) { nextToken = file.getNextToken(nextToken); } nextToken = file.getNextToken(nextToken); if (!nextToken || !(nextToken.type === 'Punctuator' && nextToken.value === '.')) { errors.add( 'jQuery identifiers must start with a $', left.loc.start.line, left.loc.start.column ); } } if (type === 'VariableDeclarator') { if (token.id.type === 'ObjectPattern' || token.id.type === 'ArrayPattern') { return; } left = token.id; varName = left.name; right = token.init; checkIfVarNameShouldStartWithDollar(varName, left, right); } else if (ignoreProperties) { return; } else if (type === 'AssignmentExpression') { left = token.left; if (left.computed) { return; } varName = left.name || left.property.name; right = token.right; checkIfVarNameShouldStartWithDollar(varName, left, right); } else {// type === 'ObjectExpression' var props = token.properties; if (!props) { return; } props.forEach(function(prop) { left = prop.key; if (!left.name) { return; } varName = left.name; right = prop.value; checkIfVarNameShouldStartWithDollar(varName, left, right); }); } }); } |
| Function (anonymous_833) | |
|---|---|
| ✓ Was called | /**··· * Require a $ before variable names that are jquery assignments. * * Types: `Boolean` or `Strfunction(token) { var type = token.type; var left; var varName; var right; function checkIfVarNameShouldStartWithDollar(varName, left, right) { if (/^_?\$/.test(varName)) { return; } if (!right || right.type !== 'CallExpression') { return; } var nextToken = file.getTokenByRangeStart(right.callee.range[0]); if (nextToken.value !== '$') { return; } nextToken = file.getNextToken(nextToken); if (nextToken.value !== '(') { return; } while (!(nextToken.type === 'Punctuator' && nextToken.value === ')')) { nextToken = file.getNextToken(nextToken); } nextToken = file.getNextToken(nextToken); if (!nextToken || !(nextToken.type === 'Punctuator' && nextToken.value === '.')) { errors.add( 'jQuery identifiers must start with a $', left.loc.start.line, left.loc.start.column ); } } if (type === 'VariableDeclarator') { if (token.id.type === 'ObjectPattern' || token.id.type === 'ArrayPattern') { return; } left = token.id; varName = left.name; right = token.init; checkIfVarNameShouldStartWithDollar(varName, left, right); } else if (ignoreProperties) { return; } else if (type === 'AssignmentExpression') { left = token.left; if (left.computed) { return; } varName = left.name || left.property.name; right = token.right; checkIfVarNameShouldStartWithDollar(varName, left, right); } else {// type === 'ObjectExpression' var props = token.properties; if (!props) { return; } props.forEach(function(prop) { left = prop.key; if (!left.name) { return; } varName = left.name; right = prop.value; checkIfVarNameShouldStartWithDollar(varName, left, right); }); } }); |
| Function checkIfVarNameShouldStartWithDollar | |
|---|---|
| ✓ Was called | /**··· * Requifunction checkIfVarNameShouldStartWithDollar(varName, left, right) { if (/^_?\$/.test(varName)) { return; } if (!right || right.type !== 'CallExpression') { return; } var nextToken = file.getTokenByRangeStart(right.callee.range[0]); if (nextToken.value !== '$') { return; } nextToken = file.getNextToken(nextToken); if (nextToken.value !== '(') { return; } while (!(nextToken.type === 'Punctuator' && nextToken.value === ')')) { nextToken = file.getNextToken(nextToken); } nextToken = file.getNextToken(nextToken); if (!nextToken || !(nextToken.type === 'Punctuator' && nextToken.value === '.')) { errors.add( 'jQuery identifiers must start with a $', left.loc.start.line, left.loc.start.column ); } } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Require a $ before variable names th{ return; } |
| ✓ Negative was executed (else) | /**··· * Require a if (!right || right.type !== 'CallExpression') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Require a $ before variable names that are jquery assign{ return; } |
| ✓ Negative was executed (else) | /**··· * Require a var nextToken = file.getTokenByRangeStart(right.callee.range[0]); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Require a $ before variright.type !== 'CallExpression') { |
| ✓ Was returned | /**··· * Require a $ b!right || right.type !== 'CallExpression') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Require a $ before variable names that{ return; } |
| ✓ Negative was executed (else) | /**··· * Require a nextToken = file.getNextToken(nextToken); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Require a $ before variable names that{ return; } |
| ✓ Negative was executed (else) | /**··· * Require a while (!(nextToken.type === 'Punctuator' && nextToken.value === ')')) { |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Require a $ before variable names that are jquery assnextToken.value === ')')) { |
| ✓ Was returned | /**··· * Require a $ beforenextToken.type === 'Punctuator' && nextToken.value === ')')) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Require a $ before variable names that are jquery assignments. * * Types: `Boolean` or `{ errors.add( 'jQuery identifiers must start with a $', left.loc.start.line, left.loc.start.column ); } |
| ✓ Negative was executed (else) | /**··· * Require a } |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Require a $ before variable!(nextToken.type === 'Punctuator' && nextToken.value === '.')) { |
| ✗ Was not returned | /**··· * Require a $ b!nextToken || !(nextToken.type === 'Punctuator' && nextToken.value === '.')) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Require a $ before variable names that are jquery assignments. nextToken.value === '.')) { |
| ✓ Was returned | /**··· * Require a $ before variable nnextToken.type === 'Punctuator' && nextToken.value === '.')) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Require a $ before variable names that a{ if (token.id.type === 'ObjectPattern' || token.id.type === 'ArrayPattern') { return; } left = token.id; varName = left.name; right = token.init; checkIfVarNameShouldStartWithDollar(varName, left, right); } else if (ignoreProperties) { |
| ✓ Negative was executed (else) | /**··· * Require a $ if (ignoreProperties) { return; } else if (type === 'AssignmentExpression') { left = token.left; if (left.computed) { return; } varName = left.name || left.property.name; right = token.right; checkIfVarNameShouldStartWithDollar(varName, left, right); } else {// type === 'ObjectExpression' var props = token.properties; if (!props) { return; } props.forEach(function(prop) { left = prop.key; if (!left.name) { return; } varName = left.name; right = prop.value; checkIfVarNameShouldStartWithDollar(varName, left, right); }); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Require a $ before variable names that are jquery assignments. * * Types: `Boolean{ return; } |
| ✓ Negative was executed (else) | /**··· * Require a left = token.id; |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Require a $ before variable names that are jquery token.id.type === 'ArrayPattern') { |
| ✓ Was returned | /**··· * Require a $ btoken.id.type === 'ObjectPattern' || token.id.type === 'ArrayPattern') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Require a $ before variable names { return; } else if (type === 'AssignmentExpression') { |
| ✓ Negative was executed (else) | /**··· * Require a $ if (type === 'AssignmentExpression') { left = token.left; if (left.computed) { return; } varName = left.name || left.property.name; right = token.right; checkIfVarNameShouldStartWithDollar(varName, left, right); } else {// type === 'ObjectExpression' var props = token.properties; if (!props) { return; } props.forEach(function(prop) { left = prop.key; if (!left.name) { return; } varName = left.name; right = prop.value; checkIfVarNameShouldStartWithDollar(varName, left, right); }); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Require a $ before variable names that are jquery{ left = token.left; if (left.computed) { return; } varName = left.name || left.property.name; right = token.right; checkIfVarNameShouldStartWithDollar(varName, left, right); } else {// type === 'ObjectExpression' |
| ✓ Negative was executed (else) | /**··· * Require a $ {// type === 'ObjectExpression' var props = token.properties; if (!props) { return; } props.forEach(function(prop) { left = prop.key; if (!left.name) { return; } varName = left.name; right = prop.value; checkIfVarNameShouldStartWithDollar(varName, left, right); }); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Require a $ before variable { return; } |
| ✓ Negative was executed (else) | /**··· * Require a varName = left.name || left.property.name; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Require a $ before variable nameleft.property.name; |
| ✓ Was returned | /**··· * Require a $ before left.name || left.property.name; |
| Branch IfStatement | |
|---|---|
| ✗ Positive was not executed (if) | /**··· * Require a $ before va{ return; } |
| ✓ Negative was executed (else) | /**··· * Require a props.forEach(function(prop) { |
| Function (anonymous_835) | |
|---|---|
| ✓ Was called | /**··· * Require a $ before varifunction(prop) { left = prop.key; if (!left.name) { return; } varName = left.name; right = prop.value; checkIfVarNameShouldStartWithDollar(varName, left, right); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Require a $ before variable n{ return; } |
| ✓ Negative was executed (else) | /**··· * Require a $ be varName = left.name; |
| Function (anonymous_836) | |
|---|---|
| ✓ Was called | /**··· * Requires mfunction() {}; |
| Function (anonymous_837) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { if (typeof options !== 'object') { assert( options === true || options === 'except_snake_case', this.getOptionName() + ' option requires either a true value or an object' ); var _options = {}; if (options === 'except_snake_case') { _options.allExcept = ['snake_case']; } return this.configure(_options); } assert( !options.allExcept || Array.isArray(options.allExcept), 'allExcept value of ' + this.getOptionName() + ' option requires an array with exceptions' ); if (Array.isArray(options.allExcept)) { this._exceptSnakeCase = options.allExcept.indexOf('snake_case') > -1; this._exceptKeywords = options.allExcept.indexOf('keywords') > -1; } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires member expressions to use{ assert( options === true || options === 'except_snake_case', this.getOptionName() + ' option requires either a true value or an object' ); var _options = {}; if (options === 'except_snake_case') { _options.allExcept = ['snake_case']; } return this.configure(_options); } |
| ✓ Negative was executed (else) | /**··· * Re assert( |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires member expressions toptions === 'except_snake_case', |
| ✓ Was returned | /**··· * Requires options === true || options === 'except_snake_case', |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires member expressions to use dot not{ _options.allExcept = ['snake_case']; } |
| ✓ Negative was executed (else) | /**··· * Requir return this.configure(_options); |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires member expressionsArray.isArray(options.allExcept), |
| ✓ Was returned | /**··· * Requi!options.allExcept || Array.isArray(options.allExcept), |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires member expressions to use dot { this._exceptSnakeCase = options.allExcept.indexOf('snake_case') > -1; this._exceptKeywords = options.allExcept.indexOf('keywords') > -1; } |
| ✓ Negative was executed (else) | /**··· * Re }, |
| Function (anonymous_838) | |
|---|---|
| ✓ Was called | /**··· * Requires memfunction() { return 'requireDotNotation'; }, |
| Function (anonymous_839) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var exceptSnakeCase = this._exceptSnakeCase; var exceptKeywords = this._exceptKeywords; var dialect = file.getDialect(); file.iterateNodesByType('MemberExpression', function(node) { if (!node.computed || node.property.type !== 'Literal') { return; } var value = node.property.value; if (// allow numbers, nulls, and anything else typeof value !== 'string' || // allow invalid identifiers !utils.isValidIdentifierName(value, file.getDialect()) || // allow quoted snake cased identifiers if allExcept: ['snake_case'] (exceptSnakeCase && utils.isSnakeCased(utils.trimUnderscores(value))) || // allow quoted reserved words if allExcept: ['keywords'] ((dialect === 'es3' || exceptKeywords) && reservedWords.check(value, dialect, true)) ) { return; } errors.add( 'Use dot notation instead of brackets for member expressions', node.property.loc.start ); }); } |
| Function (anonymous_840) | |
|---|---|
| ✓ Was called | /**··· * Requires member expressions to use dot notatifunction(node) { if (!node.computed || node.property.type !== 'Literal') { return; } var value = node.property.value; if (// allow numbers, nulls, and anything else typeof value !== 'string' || // allow invalid identifiers !utils.isValidIdentifierName(value, file.getDialect()) || // allow quoted snake cased identifiers if allExcept: ['snake_case'] (exceptSnakeCase && utils.isSnakeCased(utils.trimUnderscores(value))) || // allow quoted reserved words if allExcept: ['keywords'] ((dialect === 'es3' || exceptKeywords) && reservedWords.check(value, dialect, true)) ) { return; } errors.add( 'Use dot notation instead of brackets for member expressions', node.property.loc.start ); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires member expressions to use dot notation when possible{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir var value = node.property.value; |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires member expressionsnode.property.type !== 'Literal') { |
| ✓ Was returned | /**··· * Requires !node.computed || node.property.type !== 'Literal') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Require{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir errors.add( |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires m(dialect === 'es3' || exceptKeywords) && reservedWords.check(value, dialect, true)) |
| ✓ Was returned | /**··· * Requires typeof value !== 'string' || // allow invalid identifiers !utils.isValidIdentifierName(value, file.getDialect()) || // allow quoted snake cased identifiers if allExcept: ['snake_case'] (exceptSnakeCase && utils.isSnakeCased(utils.trimUnderscores(value))) || |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires mexceptSnakeCase && utils.isSnakeCased(utils.trimUnderscores(value))) || |
| ✓ Was returned | /**··· * Requires typeof value !== 'string' || // allow invalid identifiers !utils.isValidIdentifierName(value, file.getDialect()) || |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires !utils.isValidIdentifierName(value, file.getDialect()) || |
| ✓ Was returned | /**··· * Requires typeof value !== 'string' || |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires member expressions tutils.isSnakeCased(utils.trimUnderscores(value))) || |
| ✓ Was returned | /**··· * Requires mexceptSnakeCase && utils.isSnakeCased(utils.trimUnderscores(value))) || |
| Branch LogicalExpression | |
|---|---|
| ✗ Was not returned | /**··· * Requires member expressions to use dot notation whereservedWords.check(value, dialect, true)) |
| ✓ Was returned | /**··· * Requires medialect === 'es3' || exceptKeywords) && reservedWords.check(value, dialect, true)) |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires member expressions to uexceptKeywords) && reservedWords.check(value, dialect, true)) |
| ✗ Was not returned | /**··· * Requires medialect === 'es3' || exceptKeywords) && reservedWords.check(value, dialect, true)) |
| Function (anonymous_841) | |
|---|---|
| ✓ Was called | /**··· * Requires tfunction() {}; |
| Function (anonymous_842) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { assert( options === true, this.getOptionName() + ' option allow only the `true` value' ); }, |
| Function (anonymous_843) | |
|---|---|
| ✓ Was called | /**··· * Requires to function() { return 'requireEarlyReturn'; }, |
| Function (anonymous_844) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { function addError(entity) { errors.add( 'Use of else after return', entity.loc.start.line, entity.loc.start.column ); } // Check if the IfStatement node contain a ReturnStatement. // If the node has a block, check all the statements in backward order to see if there is one. // This is to ensure that code like this will still return true: // // if (true) { // return; // eval(); // } function hasNodeReturn(node) { if (node.type === 'BlockStatement') { for (var i = node.body.length - 1; i >= 0; i--) { if (node.body[i].type === 'ReturnStatement') { return true; } } return false; } return node.type === 'ReturnStatement'; } file.iterateNodesByType('IfStatement', function(node) { if (!node.alternate) { return; } // Check if all the parents have a return statement, if not continue to the following IfStatement node. // // Example: // // if (foo) { // return; // } else if (bar) { <-- error // bar(); // } else if (baz) { <-- safe // return baz(); // } else { <-- safe // bas(); // } for (var nodeIf = node; nodeIf && nodeIf.type === 'IfStatement'; nodeIf = nodeIf.parentNode) { if (nodeIf.alternate && !hasNodeReturn(nodeIf.consequent)) { return; } } return addError(file.getPrevToken(file.getFirstNodeToken(node.alternate))); }); } |
| Function addError | |
|---|---|
| ✓ Was called | /**··· * Rfunction addError(entity) { errors.add( 'Use of else after return', entity.loc.start.line, entity.loc.start.column ); } |
| Function hasNodeReturn | |
|---|---|
| ✓ Was called | /**··· * Rfunction hasNodeReturn(node) { if (node.type === 'BlockStatement') { for (var i = node.body.length - 1; i >= 0; i--) { if (node.body[i].type === 'ReturnStatement') { return true; } } return false; } return node.type === 'ReturnStatement'; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires to return early in a function. { for (var i = node.body.length - 1; i >= 0; i--) { if (node.body[i].type === 'ReturnStatement') { return true; } } return false; } |
| ✓ Negative was executed (else) | /**··· * Requir return node.type === 'ReturnStatement'; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires to return early in a function. * * Types: `Bool{ return true; } |
| ✓ Negative was executed (else) | /**··· * Requires to re } |
| Function (anonymous_847) | |
|---|---|
| ✓ Was called | /**··· * Requires to return early in a function. function(node) { if (!node.alternate) { return; } // Check if all the parents have a return statement, if not continue to the following IfStatement node. // // Example: // // if (foo) { // return; // } else if (bar) { <-- error // bar(); // } else if (baz) { <-- safe // return baz(); // } else { <-- safe // bas(); // } for (var nodeIf = node; nodeIf && nodeIf.type === 'IfStatement'; nodeIf = nodeIf.parentNode) { if (nodeIf.alternate && !hasNodeReturn(nodeIf.consequent)) { return; } } return addError(file.getPrevToken(file.getFirstNodeToken(node.alternate))); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires to return early i{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir // Check if all the parents have a return statement, if not continue to the following IfStatement node. |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires to return early in a function.nodeIf.type === 'IfStatement'; nodeIf = nodeIf.parentNode) { |
| ✗ Was not returned | /**··· * Requires to return early in anodeIf && nodeIf.type === 'IfStatement'; nodeIf = nodeIf.parentNode) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires to return early in a function. * * Types: `Boolean` * *{ return; } |
| ✓ Negative was executed (else) | /**··· * Requires t } |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires to return early in a fun!hasNodeReturn(nodeIf.consequent)) { |
| ✓ Was returned | /**··· * Requires to rnodeIf.alternate && !hasNodeReturn(nodeIf.consequent)) { |
| Function (anonymous_848) | |
|---|---|
| ✓ Was called | /**··· * Requires dfunction() { }; |
| Function (anonymous_849) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(option) { assert(option === true, this.getOptionName() + ' requires a true value'); }, |
| Function (anonymous_850) | |
|---|---|
| ✓ Was called | /**··· * Requires decfunction() { return 'requireEnhancedObjectLiterals'; }, |
| Function (anonymous_851) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { file.iterateNodesByType('Property', function(node) { // node.key.name is used when the property key is an unquoted identifier // node.key.value is used when the property key is a quoted string var propertyName = node.key.name || node.key.value; var valueName = node.value.name; var shorthand = node.shorthand; var computed = node.computed; // check for non-shorthand properties if (propertyName && propertyName === valueName && !(shorthand || computed)) { errors.add( 'Property assignment should use enhanced object literal function.\n' + ' `{ propName: propName }` is not allowed.', node.loc.start ); } // check for non-method function properties var valueType = node.value.type; var valueIsMethod = node.method; if (valueType === 'FunctionExpression' && !valueIsMethod) { errors.add( 'Property assignment should use enhanced object literal function.\n' + ' `{ funcName: function() {} }` is not allowed.', node.loc.start ); } }); } |
| Function (anonymous_852) | |
|---|---|
| ✓ Was called | /**··· * Requires declaring objects via ES6 enfunction(node) { // node.key.name is used when the property key is an unquoted identifier // node.key.value is used when the property key is a quoted string var propertyName = node.key.name || node.key.value; var valueName = node.value.name; var shorthand = node.shorthand; var computed = node.computed; // check for non-shorthand properties if (propertyName && propertyName === valueName && !(shorthand || computed)) { errors.add( 'Property assignment should use enhanced object literal function.\n' + ' `{ propName: propName }` is not allowed.', node.loc.start ); } // check for non-method function properties var valueType = node.value.type; var valueIsMethod = node.method; if (valueType === 'FunctionExpression' && !valueIsMethod) { errors.add( 'Property assignment should use enhanced object literal function.\n' + ' `{ funcName: function() {} }` is not allowed.', node.loc.start ); } }); |
| Branch LogicalExpression | |
|---|---|
| ✗ Was not returned | /**··· * Requires declaring objects via ES6 enhancnode.key.value; |
| ✓ Was returned | /**··· * Requires declaring objecnode.key.name || node.key.value; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires declaring objects via ES6 enhanced object literals * * Type: `Boolean`{ errors.add( 'Property assignment should use enhanced object literal function.\n' + ' `{ propName: propName }` is not allowed.', node.loc.start ); } |
| ✓ Negative was executed (else) | /**··· * Requir // check for non-method function properties |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires declaring objects via ES6 enhanced object lite!(shorthand || computed)) { |
| ✓ Was returned | /**··· * Requires propertyName && propertyName === valueName && !(shorthand || computed)) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires declaring objectpropertyName === valueName && !(shorthand || computed)) { |
| ✗ Was not returned | /**··· * Requires propertyName && propertyName === valueName && !(shorthand || computed)) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires declaring objects via ES6 enhanced object literals * * Typecomputed)) { |
| ✓ Was returned | /**··· * Requires declaring objects via ES6 enhanced object literashorthand || computed)) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires declaring objects via ES6 enhanced object literals * { errors.add( 'Property assignment should use enhanced object literal function.\n' + ' `{ funcName: function() {} }` is not allowed.', node.loc.start ); } |
| ✓ Negative was executed (else) | /**··· * Requir }); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires declaring objects via ES6 enhanced obj!valueIsMethod) { |
| ✓ Was returned | /**··· * Requires valueType === 'FunctionExpression' && !valueIsMethod) { |
| Function (anonymous_853) | |
|---|---|
| ✓ Was called | /**··· * Requires ffunction() {}; |
| Function (anonymous_854) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_855) | |
|---|---|
| ✓ Was called | /**··· * Requires funfunction() { return 'requireFunctionDeclarations'; }, |
| Function (anonymous_856) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { file.iterateNodesByType( 'VariableDeclarator', function(node) { if (node.init && node.init.type === 'FunctionExpression') { errors.add('Use a function declaration instead', node.loc.start); } } ); file.iterateNodesByType( 'AssignmentExpression', function(node) { if (node.left.type !== 'MemberExpression' && node.right.type === 'FunctionExpression') { errors.add('Use a function declaration instead', node.loc.start); } } ); } |
| Function (anonymous_857) | |
|---|---|
| ✓ Was called | /**··· * Requifunction(node) { if (node.init && node.init.type === 'FunctionExpression') { errors.add('Use a function declaration instead', node.loc.start); } } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires function declarations by disallowing assignment of functio{ errors.add('Use a function declaration instead', node.loc.start); } |
| ✓ Negative was executed (else) | /**··· * Requires f } |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires function declaratnode.init.type === 'FunctionExpression') { |
| ✓ Was returned | /**··· * Requires funcnode.init && node.init.type === 'FunctionExpression') { |
| Function (anonymous_858) | |
|---|---|
| ✓ Was called | /**··· * Requifunction(node) { if (node.left.type !== 'MemberExpression' && node.right.type === 'FunctionExpression') { errors.add('Use a function declaration instead', node.loc.start); } } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires function declarations by disallowing assignmen{ errors.add('Use a function declaration instead', node.loc.start); } |
| ✓ Negative was executed (else) | /**··· * Requires f } |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires funcnode.right.type === 'FunctionExpression') { |
| ✓ Was returned | /**··· * Requires funcnode.left.type !== 'MemberExpression' && |
| Function (anonymous_859) | |
|---|---|
| ✓ Was called | /**··· * Requires pfunction() {}; |
| Function (anonymous_860) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(keywords) { assert(Array.isArray(keywords), this.getOptionName() + ' option requires array value'); this._keywords = keywords; }, |
| Function (anonymous_861) | |
|---|---|
| ✓ Was called | /**··· * Requires plafunction() { return 'requireKeywordsOnNewLine'; }, |
| Function (anonymous_862) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { file.iterateTokensByTypeAndValue('Keyword', this._keywords, function(token) { errors.assert.differentLine({ token: file.getPrevToken(token), nextToken: token }); }); } |
| Function (anonymous_863) | |
|---|---|
| ✓ Was called | /**··· * Requires placing keywords on a new line. * * Type: `Array` function(token) { errors.assert.differentLine({ token: file.getPrevToken(token), nextToken: token }); }); |
| Function (anonymous_864) | |
|---|---|
| ✓ Was called | /**··· * Requires pfunction() {}; |
| Function (anonymous_865) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_866) | |
|---|---|
| ✓ Was called | /**··· * Requires plafunction() { return 'requireLineBreakAfterVariableAssignment'; }, |
| Function (anonymous_867) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var lastDeclaration; file.iterateNodesByType('VariableDeclaration', function(node) { if (node.parentNode.type === 'ForStatement' || node.parentNode.type === 'ForInStatement' || node.parentNode.type === 'ForOfStatement') { return; } for (var i = 0; i < node.declarations.length; i++) { var thisDeclaration = node.declarations[i]; if (thisDeclaration.parentNode.kind === 'var' || thisDeclaration.parentNode.kind === 'let' || thisDeclaration.parentNode.kind === 'const') { if (lastDeclaration && lastDeclaration.init) { errors.assert.differentLine({ token: lastDeclaration, nextToken: thisDeclaration, message: 'Variable assignments should be followed by new line' }); } lastDeclaration = thisDeclaration; } } }); } |
| Function (anonymous_868) | |
|---|---|
| ✓ Was called | /**··· * Requires placing line feed after assigning a varfunction(node) { if (node.parentNode.type === 'ForStatement' || node.parentNode.type === 'ForInStatement' || node.parentNode.type === 'ForOfStatement') { return; } for (var i = 0; i < node.declarations.length; i++) { var thisDeclaration = node.declarations[i]; if (thisDeclaration.parentNode.kind === 'var' || thisDeclaration.parentNode.kind === 'let' || thisDeclaration.parentNode.kind === 'const') { if (lastDeclaration && lastDeclaration.init) { errors.assert.differentLine({ token: lastDeclaration, nextToken: thisDeclaration, message: 'Variable assignments should be followed by new line' }); } lastDeclaration = thisDeclaration; } } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires placing line feed after assigning a variabl{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir for (var i = 0; i < node.declarations.length; i++) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires node.parentNode.type === 'ForOfStatement') { |
| ✓ Was returned | /**··· * Requires node.parentNode.type === 'ForStatement' || node.parentNode.type === 'ForInStatement' || |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires node.parentNode.type === 'ForInStatement' || |
| ✓ Was returned | /**··· * Requires node.parentNode.type === 'ForStatement' || |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires placing line feed after assigning a variable. * { if (lastDeclaration && lastDeclaration.init) { errors.assert.differentLine({ token: lastDeclaration, nextToken: thisDeclaration, message: 'Variable assignments should be followed by new line' }); } lastDeclaration = thisDeclaration; } |
| ✗ Negative was not executed (else) | /**··· * Requires p } |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires placthisDeclaration.parentNode.kind === 'const') { |
| ✓ Was returned | /**··· * Requires placthisDeclaration.parentNode.kind === 'var' || thisDeclaration.parentNode.kind === 'let' || |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires placthisDeclaration.parentNode.kind === 'let' || |
| ✓ Was returned | /**··· * Requires placthisDeclaration.parentNode.kind === 'var' || |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires placing line feed after assigning a variable. * { errors.assert.differentLine({ token: lastDeclaration, nextToken: thisDeclaration, message: 'Variable assignments should be followed by new line' }); } |
| ✓ Negative was executed (else) | /**··· * Requires placi lastDeclaration = thisDeclaration; |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires placing line feed after asslastDeclaration.init) { |
| ✓ Was returned | /**··· * Requires placing lastDeclaration && lastDeclaration.init) { |
| Function (anonymous_869) | |
|---|---|
| ✓ Was called | /**··· * Requires pfunction() {}; |
| Function (anonymous_870) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_871) | |
|---|---|
| ✓ Was called | /**··· * Requires plafunction() { return 'requireLineFeedAtFileEnd'; }, |
| Function (anonymous_872) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var lastToken = file.getLastToken({includeComments: true}); var prevToken = file.getPrevToken(lastToken, {includeComments: true}); errors.assert.differentLine({ token: prevToken, nextToken: lastToken, message: 'Missing line feed at file end' }); } |
| Function (anonymous_873) | |
|---|---|
| ✓ Was called | /**··· * Requires ffunction() {}; |
| Function (anonymous_874) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(requireMatchingFunctionName) { if (typeof requireMatchingFunctionName === 'object') { assert(requireMatchingFunctionName.includeModuleExports === true, 'requireMatchingFunctionName option requires includeModuleExports property to be true for object'); this._includeModuleExports = requireMatchingFunctionName.includeModuleExports; } else { assert( requireMatchingFunctionName === true, 'requireMatchingFunctionName option requires true value or should be removed' ); } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires function names to match member and property n{ assert(requireMatchingFunctionName.includeModuleExports === true, 'requireMatchingFunctionName option requires includeModuleExports property to be true for object'); this._includeModuleExports = requireMatchingFunctionName.includeModuleExports; } else { |
| ✓ Negative was executed (else) | /**··· * Requires{ assert( requireMatchingFunctionName === true, 'requireMatchingFunctionName option requires true value or should be removed' ); } |
| Function (anonymous_875) | |
|---|---|
| ✓ Was called | /**··· * Requires funfunction() { return 'requireMatchingFunctionName'; }, |
| Function (anonymous_876) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var _includeModuleExports = this._includeModuleExports; file.iterateNodesByType(['FunctionExpression'], function(node) { switch (node.parentNode.type) { // var foo = function bar() {} // object.foo = function bar() {} // object['foo'] = function bar() {} case 'AssignmentExpression': if (_includeModuleExports || !_isModuleExports(node.parentNode.left)) { checkForMember(node.parentNode, skip, errors); } break; // object = {foo: function bar() {}} case 'Property': checkForProperty(node.parentNode, skip, errors); break; } }); function skip(key, value) { // We don't care about anonymous functions as // those should be enforced by separate rule if (!value.id) { return true; } // Relax a bit when reserved word is detected if (reservedWords.check(key, file.getDialect(), true)) { return true; } } } |
| Function (anonymous_877) | |
|---|---|
| ✓ Was called | /**··· * Requires function names to match member and propefunction(node) { switch (node.parentNode.type) { // var foo = function bar() {} // object.foo = function bar() {} // object['foo'] = function bar() {} case 'AssignmentExpression': if (_includeModuleExports || !_isModuleExports(node.parentNode.left)) { checkForMember(node.parentNode, skip, errors); } break; // object = {foo: function bar() {}} case 'Property': checkForProperty(node.parentNode, skip, errors); break; } }); |
| Branch SwitchStatement | |
|---|---|
| ✓ Was evaluated | /**··· * Requires case 'AssignmentExpression': if (_includeModuleExports || !_isModuleExports(node.parentNode.left)) { checkForMember(node.parentNode, skip, errors); } break; |
| ✓ Was evaluated | /**··· * Requires case 'Property': checkForProperty(node.parentNode, skip, errors); break; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires function names to match member and property names. * * It doesn't affect{ checkForMember(node.parentNode, skip, errors); } |
| ✓ Negative was executed (else) | /**··· * Requires funct break; |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires function names to match member an!_isModuleExports(node.parentNode.left)) { |
| ✓ Was returned | /**··· * Requires function_includeModuleExports || !_isModuleExports(node.parentNode.left)) { |
| Function skip | |
|---|---|
| ✓ Was called | /**··· * Rfunction skip(key, value) { // We don't care about anonymous functions as // those should be enforced by separate rule if (!value.id) { return true; } // Relax a bit when reserved word is detected if (reservedWords.check(key, file.getDialect(), true)) { return true; } } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires function na{ return true; } |
| ✓ Negative was executed (else) | /**··· * Requir // Relax a bit when reserved word is detected |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires function names to match member and property names. { return true; } |
| ✓ Negative was executed (else) | /**··· * Requir } |
| Function _isModuleExports | |
|---|---|
| ✓ Was called | function _isModuleExports(pattern) {··· if (pattern.type === 'MemberExpression') { // must be module.sth if (pattern.object.type === 'Identifier' && pattern.object.name === 'module') { if (pattern.property.type === 'Identifier' && pattern.property.name === 'exports') { // sth.exports return true; } else if (pattern.property.type === 'Literal' && pattern.property.value === 'exports') { // sth["exports"] return true; } } } return false; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires function names to match membe{ // must be module.sth if (pattern.object.type === 'Identifier' && pattern.object.name === 'module') { if (pattern.property.type === 'Identifier' && pattern.property.name === 'exports') { // sth.exports return true; } else if (pattern.property.type === 'Literal' && pattern.property.value === 'exports') { // sth["exports"] return true; } } } |
| ✓ Negative was executed (else) | /**··· return false; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires function names to match member{ if (pattern.property.type === 'Identifier' && pattern.property.name === 'exports') { // sth.exports return true; } else if (pattern.property.type === 'Literal' && pattern.property.value === 'exports') { // sth["exports"] return true; } } |
| ✓ Negative was executed (else) | /**··· * Re } |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requipattern.object.name === 'module') { |
| ✓ Was returned | /**··· * Requipattern.object.type === 'Identifier' && |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires function names to match member and pr{ // sth.exports return true; } else if (pattern.property.type === 'Literal' && |
| ✓ Negative was executed (else) | /**··· * Requires funif (pattern.property.type === 'Literal' && pattern.property.value === 'exports') { // sth["exports"] return true; } |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires pattern.property.name === 'exports') { |
| ✓ Was returned | /**··· * Requires pattern.property.type === 'Identifier' && |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires function names to match member and pro{ // sth["exports"] return true; } |
| ✗ Negative was not executed (else) | /**··· * Requir } |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires pattern.property.value === 'exports') { |
| ✗ Was not returned | /**··· * Requires functiopattern.property.type === 'Literal' && |
| Function _resolvePatternName | |
|---|---|
| ✓ Was called | function _resolvePatternName(pattern) {··· switch (pattern.type) { case 'Identifier': // prop = ...; return pattern.name; case 'Literal': // obj['prop'] = ...; return pattern.value; case 'MemberExpression': // obj.prop = ...; return _resolvePatternName(pattern.property); default: // Something unhandy like obj['x' + 2] = ...; return false; } } |
| Branch SwitchStatement | |
|---|---|
| ✓ Was evaluated | /**··· * Rcase 'Identifier': // prop = ...; return pattern.name; |
| ✓ Was evaluated | /**··· * Rcase 'Literal': // obj['prop'] = ...; return pattern.value; |
| ✓ Was evaluated | /**··· * Rcase 'MemberExpression': // obj.prop = ...; return _resolvePatternName(pattern.property); |
| ✓ Was evaluated | /**··· * Rdefault: // Something unhandy like obj['x' + 2] = ...; return false; |
| Function checkForMember | |
|---|---|
| ✓ Was called | function checkForMember(assignment, skip, errors) {··· var _name = _resolvePatternName(assignment.left); if (_name === false || skip(_name, assignment.right)) { return; } if (_name !== assignment.right.id.name) { errors.add( 'Function name does not match member name', assignment.loc.start ); } } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires function names to match member and propert{ return; } |
| ✓ Negative was executed (else) | /**··· if (_name !== assignment.right.id.name) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires function naskip(_name, assignment.right)) { |
| ✓ Was returned | /**··· * R_name === false || skip(_name, assignment.right)) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires function names to match memb{ errors.add( 'Function name does not match member name', assignment.loc.start ); } |
| ✓ Negative was executed (else) | /**··· } |
| Function checkForProperty | |
|---|---|
| ✓ Was called | function checkForProperty(property, skip, errors) {··· var _name = _resolvePatternName(property.key); if (_name === false || skip(_name, property.value)) { return; } if (_name !== property.value.id.name) { errors.add( 'Function name does not match property name', property.loc.start ); } } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires function names to match member and prope{ return; } |
| ✓ Negative was executed (else) | /**··· if (_name !== property.value.id.name) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires function naskip(_name, property.value)) { |
| ✓ Was returned | /**··· * R_name === false || skip(_name, property.value)) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires function names to match me{ errors.add( 'Function name does not match property name', property.loc.start ); } |
| ✓ Negative was executed (else) | /**··· } |
| Function (anonymous_883) | |
|---|---|
| ✓ Was called | /**··· * Requires tfunction() {}; |
| Function (anonymous_884) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_885) | |
|---|---|
| ✓ Was called | /**··· * Requires thefunction() { return 'requireMultiLineTernary'; }, |
| Function (anonymous_886) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { file.iterateNodesByType('ConditionalExpression', function(node) { errors.assert.differentLine({ token: node.test, nextToken: node.consequent, message: 'Missing new line after test' }); errors.assert.differentLine({ token: node.consequent, nextToken: node.alternate, message: 'Missing new line after consequent' }); }); } |
| Function (anonymous_887) | |
|---|---|
| ✓ Was called | /**··· * Requires the test, consequent and alternate to be function(node) { errors.assert.differentLine({ token: node.test, nextToken: node.consequent, message: 'Missing new line after test' }); errors.assert.differentLine({ token: node.consequent, nextToken: node.alternate, message: 'Missing new line after consequent' }); }); |
| Function consecutive | |
|---|---|
| ✓ Was called | function consecutive(file, errors) {··· file.iterateNodesByType('VariableDeclaration', function(node) { var pos = node.parentCollection.indexOf(node); if (pos < node.parentCollection.length - 1) { var sibling = node.parentCollection[pos + 1]; if (sibling.type === 'VariableDeclaration' && sibling.kind === node.kind) { errors.add( node.kind[0].toUpperCase() + node.kind.slice(1) + ' declarations should be joined', sibling.loc.start ); } } }); } |
| Function (anonymous_889) | |
|---|---|
| ✓ Was called | /**··· * Requires multiple `var` declaration. * * Tfunction(node) { var pos = node.parentCollection.indexOf(node); if (pos < node.parentCollection.length - 1) { var sibling = node.parentCollection[pos + 1]; if (sibling.type === 'VariableDeclaration' && sibling.kind === node.kind) { errors.add( node.kind[0].toUpperCase() + node.kind.slice(1) + ' declarations should be joined', sibling.loc.start ); } } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires multiple `var` declaration. * * Ty{ var sibling = node.parentCollection[pos + 1]; if (sibling.type === 'VariableDeclaration' && sibling.kind === node.kind) { errors.add( node.kind[0].toUpperCase() + node.kind.slice(1) + ' declarations should be joined', sibling.loc.start ); } } |
| ✓ Negative was executed (else) | /**··· * Re }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires multiple `var` declaration. * * Types: `Boolean` or `String` or `Obj{ errors.add( node.kind[0].toUpperCase() + node.kind.slice(1) + ' declarations should be joined', sibling.loc.start ); } |
| ✓ Negative was executed (else) | /**··· * Requir } |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires multiple `var` declaration. * * Types: `sibling.kind === node.kind) { |
| ✓ Was returned | /**··· * Requires sibling.type === 'VariableDeclaration' && sibling.kind === node.kind) { |
| Function onevar | |
|---|---|
| ✓ Was called | function onevar(file, errors) {··· file.iterateNodesByType(['Program', 'FunctionDeclaration', 'FunctionExpression'], function(node) { var firstVar = true; var firstConst = true; var firstParent = true; file.iterate(function(node) { var type = node.type; var kind = node.kind; // Don't go in nested scopes if (!firstParent && ['FunctionDeclaration', 'FunctionExpression'].indexOf(type) > -1) { return false; } if (firstParent) { firstParent = false; } if (type === 'VariableDeclaration') { if (kind === 'var') { if (!firstVar) { errors.add( 'Var declarations should be joined', node.loc.start ); } else { firstVar = false; } } if (kind === 'const') { if (!firstConst) { errors.add( 'Const declarations should be joined', node.loc.start ); } else { firstConst = false; } } } }, node); }); } |
| Function (anonymous_891) | |
|---|---|
| ✓ Was called | /**··· * Requires multiple `var` declaration. * * Types: `Boolean` or `String` or `Objfunction(node) { var firstVar = true; var firstConst = true; var firstParent = true; file.iterate(function(node) { var type = node.type; var kind = node.kind; // Don't go in nested scopes if (!firstParent && ['FunctionDeclaration', 'FunctionExpression'].indexOf(type) > -1) { return false; } if (firstParent) { firstParent = false; } if (type === 'VariableDeclaration') { if (kind === 'var') { if (!firstVar) { errors.add( 'Var declarations should be joined', node.loc.start ); } else { firstVar = false; } } if (kind === 'const') { if (!firstConst) { errors.add( 'Const declarations should be joined', node.loc.start ); } else { firstConst = false; } } } }, node); }); |
| Function (anonymous_892) | |
|---|---|
| ✓ Was called | /**··· * Requires multifunction(node) { var type = node.type; var kind = node.kind; // Don't go in nested scopes if (!firstParent && ['FunctionDeclaration', 'FunctionExpression'].indexOf(type) > -1) { return false; } if (firstParent) { firstParent = false; } if (type === 'VariableDeclaration') { if (kind === 'var') { if (!firstVar) { errors.add( 'Var declarations should be joined', node.loc.start ); } else { firstVar = false; } } if (kind === 'const') { if (!firstConst) { errors.add( 'Const declarations should be joined', node.loc.start ); } else { firstConst = false; } } } }, node); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires multiple `var` declaration. * * Types: `Boolean` or `String` or `Object` * * V{ return false; } |
| ✓ Negative was executed (else) | /**··· * Requir if (firstParent) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires multiple `var` d['FunctionDeclaration', 'FunctionExpression'].indexOf(type) > -1) { |
| ✓ Was returned | /**··· * Requires !firstParent && ['FunctionDeclaration', 'FunctionExpression'].indexOf(type) > -1) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires multiple `var{ firstParent = false; } |
| ✓ Negative was executed (else) | /**··· * Requir if (type === 'VariableDeclaration') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires multiple `var` declaration. * { if (kind === 'var') { if (!firstVar) { errors.add( 'Var declarations should be joined', node.loc.start ); } else { firstVar = false; } } if (kind === 'const') { if (!firstConst) { errors.add( 'Const declarations should be joined', node.loc.start ); } else { firstConst = false; } } } |
| ✓ Negative was executed (else) | /**··· * Requir }, node); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires multiple `var` decla{ if (!firstVar) { errors.add( 'Var declarations should be joined', node.loc.start ); } else { firstVar = false; } } |
| ✓ Negative was executed (else) | /**··· * Requires m if (kind === 'const') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires multiple `var` decl{ errors.add( 'Var declarations should be joined', node.loc.start ); } else { |
| ✓ Negative was executed (else) | /**··· * Requires multiple `v{ firstVar = false; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires multiple `var` declara{ if (!firstConst) { errors.add( 'Const declarations should be joined', node.loc.start ); } else { firstConst = false; } } |
| ✓ Negative was executed (else) | /**··· * Requires m } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires multiple `var` declar{ errors.add( 'Const declarations should be joined', node.loc.start ); } else { |
| ✓ Negative was executed (else) | /**··· * Requires multiple `v{ firstConst = false; } |
| Function hasRequireStatements | |
|---|---|
| ✓ Was called | function hasRequireStatements(node) {··· if (!Array.isArray(node.declarations)) { return false; } return node.declarations.some(function(declaration) { var init = declaration.init; return init && init.callee && init.callee.name === 'require'; }); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires multiple `var` declaration.{ return false; } |
| ✓ Negative was executed (else) | /**··· return node.declarations.some(function(declaration) { |
| Function (anonymous_894) | |
|---|---|
| ✓ Was called | /**··· * Requires multiple `var` decfunction(declaration) { var init = declaration.init; return init && init.callee && init.callee.name === 'require'; }); |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requiinit.callee.name === 'require'; |
| ✓ Was returned | /**··· * Requiresinit && init.callee && |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requiinit.callee && |
| ✓ Was returned | /**··· * Requiresinit && |
| Function exceptRequire | |
|---|---|
| ✓ Was called | function exceptRequire(file, errors) {··· file.iterateNodesByType('VariableDeclaration', function(node) { if (hasRequireStatements(node)) { return; } var pos = node.parentCollection.indexOf(node); if (pos < node.parentCollection.length - 1) { var sibling = node.parentCollection[pos + 1]; if (hasRequireStatements(sibling)) { return; } if (sibling.type === 'VariableDeclaration' && sibling.kind === node.kind) { errors.add( node.kind[0].toUpperCase() + node.kind.slice(1) + ' declarations should be joined', sibling.loc.start ); } } }); } |
| Function (anonymous_896) | |
|---|---|
| ✓ Was called | /**··· * Requires multiple `var` declaration. * * Tfunction(node) { if (hasRequireStatements(node)) { return; } var pos = node.parentCollection.indexOf(node); if (pos < node.parentCollection.length - 1) { var sibling = node.parentCollection[pos + 1]; if (hasRequireStatements(sibling)) { return; } if (sibling.type === 'VariableDeclaration' && sibling.kind === node.kind) { errors.add( node.kind[0].toUpperCase() + node.kind.slice(1) + ' declarations should be joined', sibling.loc.start ); } } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires multiple `var` declarati{ return; } |
| ✓ Negative was executed (else) | /**··· * Re var pos = node.parentCollection.indexOf(node); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires multiple `var` declaration. * * Ty{ var sibling = node.parentCollection[pos + 1]; if (hasRequireStatements(sibling)) { return; } if (sibling.type === 'VariableDeclaration' && sibling.kind === node.kind) { errors.add( node.kind[0].toUpperCase() + node.kind.slice(1) + ' declarations should be joined', sibling.loc.start ); } } |
| ✓ Negative was executed (else) | /**··· * Re }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires multiple `var` declaration. * { return; } |
| ✓ Negative was executed (else) | /**··· * Requir if (sibling.type === 'VariableDeclaration' && sibling.kind === node.kind) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires multiple `var` declaration. * * Types: `Boolean` or `String` or `Obj{ errors.add( node.kind[0].toUpperCase() + node.kind.slice(1) + ' declarations should be joined', sibling.loc.start ); } |
| ✓ Negative was executed (else) | /**··· * Requir } |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires multiple `var` declaration. * * Types: `sibling.kind === node.kind) { |
| ✓ Was returned | /**··· * Requires sibling.type === 'VariableDeclaration' && sibling.kind === node.kind) { |
| Function (anonymous_897) | |
|---|---|
| ✓ Was called | /**··· * Requires mfunction() {}; |
| Function (anonymous_898) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { var isExceptRequire = typeof options === 'object' && options.allExcept.length && options.allExcept.indexOf('require') !== -1; assert( options === true || options === 'onevar' || isExceptRequire, this.getOptionName() + ' option requires a true value, `onevar` or {allExcept: [\'require\']}' ); var checkers = { true: consecutive, onevar: onevar }; this._check = isExceptRequire ? exceptRequire : checkers[options]; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires multiple `var`options.allExcept.indexOf('require') !== -1; |
| ✓ Was returned | /**··· * Requires multiple `var`typeof options === 'object' && options.allExcept.length && |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires multiple `var`options.allExcept.length && |
| ✓ Was returned | /**··· * Requires multiple `var`typeof options === 'object' && |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * RequiisExceptRequire, |
| ✓ Was returned | /**··· * Requioptions === true || options === 'onevar' || |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requioptions === 'onevar' || |
| ✓ Was returned | /**··· * Requioptions === true || |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | /**··· * Requires multiple `var` declaratiexceptRequire : checkers[options]; |
| ✓ Negative was returned (: ...) | /**··· * Requires multiple `var` declaration. * * Types:checkers[options]; |
| Function (anonymous_899) | |
|---|---|
| ✓ Was called | /**··· * Requires mulfunction() { return 'requireMultipleVarDecl'; }, |
| Function (anonymous_900) | |
|---|---|
| ✓ Was called | /**··· * Requfunction() { return this._check.apply(this, arguments); } |
| Function getNodeName | |
|---|---|
| ✓ Was called | function getNodeName(node) {··· if (node.type === 'Identifier') { return node.name; } else { return node.value; } } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Require unassigned functions { return node.name; } else { |
| ✓ Negative was executed (else) | /**··· * Requ{ return node.value; } |
| Function (anonymous_902) | |
|---|---|
| ✓ Was called | /**··· * Require unfunction() {}; |
| Function (anonymous_903) | |
|---|---|
| ✓ Was called | /**··· * Require function(options) { assert( options === true || typeof options === 'object', this.getOptionName() + ' option requires true value ' + 'or an object with String[] `allExcept` property' ); // verify first item in `allExcept` property in object (if it's an object) assert( typeof options !== 'object' || Array.isArray(options.allExcept) && typeof options.allExcept[0] === 'string', 'Property `allExcept` in ' + this.getOptionName() + ' should be an array of strings' ); if (options.allExcept) { this._allExceptItems = options.allExcept.map(function(item) { var parts = pathval.parse(item).map(function extractPart(part) { return part.i !== undefined ? part.i : part.p; }); return JSON.stringify(parts); }); } }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requitypeof options === 'object', |
| ✓ Was returned | /**··· * Requioptions === true || |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * RequiArray.isArray(options.allExcept) && typeof options.allExcept[0] === 'string', |
| ✓ Was returned | /**··· * Requitypeof options !== 'object' || |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requitypeof options.allExcept[0] === 'string', |
| ✓ Was returned | /**··· * RequiArray.isArray(options.allExcept) && |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Require unassigned funct{ this._allExceptItems = options.allExcept.map(function(item) { var parts = pathval.parse(item).map(function extractPart(part) { return part.i !== undefined ? part.i : part.p; }); return JSON.stringify(parts); }); } |
| ✓ Negative was executed (else) | /**··· * Re }, |
| Function (anonymous_904) | |
|---|---|
| ✓ Was called | /**··· * Require unassigned functions to be named inline *function(item) { var parts = pathval.parse(item).map(function extractPart(part) { return part.i !== undefined ? part.i : part.p; }); return JSON.stringify(parts); }); |
| Function extractPart | |
|---|---|
| ✓ Was called | /**··· * Require unassigned functions to be named inlifunction extractPart(part) { return part.i !== undefined ? part.i : part.p; }); |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | /**··· * Require unassigned functions to be named inpart.i : part.p; |
| ✓ Negative was returned (: ...) | /**··· * Require unassigned functions to be named inline * part.p; |
| Function (anonymous_906) | |
|---|---|
| ✓ Was called | /**··· * Require unasfunction() { return 'requireNamedUnassignedFunctions'; }, |
| Function (anonymous_907) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var _this = this; file.iterateNodesByType('FunctionExpression', function(node) { var parentNode = node.parentNode; // If the function has been named via left hand assignment, skip it // e.g. `var hello = function() {`, `foo.bar = function() {` if (parentNode.type.match(/VariableDeclarator|Property|AssignmentExpression/)) { return; } // If the function has been named, skip it // e.g. `[].forEach(function hello() {` if (node.id !== null) { return; } // If we have exceptions and the function is being invoked, detect whether we excepted it if (_this._allExceptItems && parentNode.type === 'CallExpression') { // Determine the path that resolves to our call expression // We must cover both direct calls (e.g. `it(function() {`) and // member expressions (e.g. `foo.bar(function() {`) var memberNode = parentNode.callee; var canBeRepresented = true; var fullpathParts = []; while (memberNode) { if (memberNode.type.match(/Identifier|Literal/)) { fullpathParts.unshift(getNodeName(memberNode)); } else if (memberNode.type === 'MemberExpression') { fullpathParts.unshift(getNodeName(memberNode.property)); } else { canBeRepresented = false; break; } memberNode = memberNode.object; } // If the path is not-dynamic (i.e. can be represented by static parts), // then check it against our exceptions if (canBeRepresented) { var fullpath = JSON.stringify(fullpathParts); for (var i = 0, l = _this._allExceptItems.length; i < l; i++) { if (fullpath === _this._allExceptItems[i]) { return; } } } } // Complain that this function must be named errors.add('Inline functions need to be named', node.loc.start); }); } |
| Function (anonymous_908) | |
|---|---|
| ✓ Was called | /**··· * Require unassigned functions to be named inlinefunction(node) { var parentNode = node.parentNode; // If the function has been named via left hand assignment, skip it // e.g. `var hello = function() {`, `foo.bar = function() {` if (parentNode.type.match(/VariableDeclarator|Property|AssignmentExpression/)) { return; } // If the function has been named, skip it // e.g. `[].forEach(function hello() {` if (node.id !== null) { return; } // If we have exceptions and the function is being invoked, detect whether we excepted it if (_this._allExceptItems && parentNode.type === 'CallExpression') { // Determine the path that resolves to our call expression // We must cover both direct calls (e.g. `it(function() {`) and // member expressions (e.g. `foo.bar(function() {`) var memberNode = parentNode.callee; var canBeRepresented = true; var fullpathParts = []; while (memberNode) { if (memberNode.type.match(/Identifier|Literal/)) { fullpathParts.unshift(getNodeName(memberNode)); } else if (memberNode.type === 'MemberExpression') { fullpathParts.unshift(getNodeName(memberNode.property)); } else { canBeRepresented = false; break; } memberNode = memberNode.object; } // If the path is not-dynamic (i.e. can be represented by static parts), // then check it against our exceptions if (canBeRepresented) { var fullpath = JSON.stringify(fullpathParts); for (var i = 0, l = _this._allExceptItems.length; i < l; i++) { if (fullpath === _this._allExceptItems[i]) { return; } } } } // Complain that this function must be named errors.add('Inline functions need to be named', node.loc.start); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Require unassigned functions to be named inline * * Types: `Boolean` or `Object` { return; } |
| ✓ Negative was executed (else) | /**··· * Requir // If the function has been named, skip it |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Require unassigned function{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir // If we have exceptions and the function is being invoked, detect whether we excepted it |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Require unassigned functions to be named inline * * Types: `Boolean` o{ // Determine the path that resolves to our call expression // We must cover both direct calls (e.g. `it(function() {`) and // member expressions (e.g. `foo.bar(function() {`) var memberNode = parentNode.callee; var canBeRepresented = true; var fullpathParts = []; while (memberNode) { if (memberNode.type.match(/Identifier|Literal/)) { fullpathParts.unshift(getNodeName(memberNode)); } else if (memberNode.type === 'MemberExpression') { fullpathParts.unshift(getNodeName(memberNode.property)); } else { canBeRepresented = false; break; } memberNode = memberNode.object; } // If the path is not-dynamic (i.e. can be represented by static parts), // then check it against our exceptions if (canBeRepresented) { var fullpath = JSON.stringify(fullpathParts); for (var i = 0, l = _this._allExceptItems.length; i < l; i++) { if (fullpath === _this._allExceptItems[i]) { return; } } } } |
| ✓ Negative was executed (else) | /**··· * Requir // Complain that this function must be named |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Require unassigned functions to beparentNode.type === 'CallExpression') { |
| ✓ Was returned | /**··· * Require u_this._allExceptItems && parentNode.type === 'CallExpression') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Require unassigned functions to be named inline * * Types: `{ fullpathParts.unshift(getNodeName(memberNode)); } else if (memberNode.type === 'MemberExpression') { |
| ✓ Negative was executed (else) | /**··· * Require unassigned fif (memberNode.type === 'MemberExpression') { fullpathParts.unshift(getNodeName(memberNode.property)); } else { canBeRepresented = false; break; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Require unassigned functions to be named inline * * Types: `Bo{ fullpathParts.unshift(getNodeName(memberNode.property)); } else { |
| ✓ Negative was executed (else) | /**··· * Require unassigned f{ canBeRepresented = false; break; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Require unassigned functions to{ var fullpath = JSON.stringify(fullpathParts); for (var i = 0, l = _this._allExceptItems.length; i < l; i++) { if (fullpath === _this._allExceptItems[i]) { return; } } } |
| ✓ Negative was executed (else) | /**··· * Require un } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Require unassigned functions to be named inline * * Types:{ return; } |
| ✓ Negative was executed (else) | /**··· * Require unassigned } |
| Function (anonymous_909) | |
|---|---|
| ✓ Was called | /**··· * Requires nfunction() {}; |
| Function (anonymous_910) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(settingValue) { assert( Array.isArray(settingValue) && settingValue.length || settingValue === true, 'requireNewlineBeforeBlockStatements option requires non-empty array value or true value' ); this._setting = settingValue; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires newline before opening curly brace of all block stsettingValue === true, |
| ✓ Was returned | /**··· * RequiArray.isArray(settingValue) && settingValue.length || settingValue === true, |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires newline before opening curlsettingValue.length || settingValue === true, |
| ✓ Was returned | /**··· * RequiArray.isArray(settingValue) && settingValue.length || settingValue === true, |
| Function (anonymous_911) | |
|---|---|
| ✓ Was called | /**··· * Requires newfunction() { return 'requireNewlineBeforeBlockStatements'; }, |
| Function (anonymous_912) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var setting = this._setting; function assertDifferentLine(token, nextToken) { errors.assert.differentLine({ token: token, nextToken: nextToken, message: 'Newline before curly brace for block statement is required' }); } file.iterateNodesByType('BlockStatement', function(node) { if (setting === true || setting.indexOf(getBlockType(node)) !== -1) { var openingBrace = file.getFirstNodeToken(node); var prevToken = file.getPrevToken(openingBrace); assertDifferentLine(prevToken, openingBrace); } }); if (setting === true || setting.indexOf('switch') !== -1) { file.iterateNodesByType(['SwitchStatement'], function(node) { var openingBrace = file.findNextToken(file.getLastNodeToken(node.discriminant), 'Punctuator', '{'); var prevToken = file.getPrevToken(openingBrace); assertDifferentLine(prevToken, openingBrace); }); } } |
| Function assertDifferentLine | |
|---|---|
| ✓ Was called | /**··· * Rfunction assertDifferentLine(token, nextToken) { errors.assert.differentLine({ token: token, nextToken: nextToken, message: 'Newline before curly brace for block statement is required' }); } |
| Function (anonymous_914) | |
|---|---|
| ✓ Was called | /**··· * Requires newline before opening curly bracefunction(node) { if (setting === true || setting.indexOf(getBlockType(node)) !== -1) { var openingBrace = file.getFirstNodeToken(node); var prevToken = file.getPrevToken(openingBrace); assertDifferentLine(prevToken, openingBrace); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires newline before opening curly brace of all block statements. * { var openingBrace = file.getFirstNodeToken(node); var prevToken = file.getPrevToken(openingBrace); assertDifferentLine(prevToken, openingBrace); } |
| ✓ Negative was executed (else) | /**··· * Requir }); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires newline before openisetting.indexOf(getBlockType(node)) !== -1) { |
| ✓ Was returned | /**··· * Requires setting === true || setting.indexOf(getBlockType(node)) !== -1) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires newline before opening curly brace of all block st{ file.iterateNodesByType(['SwitchStatement'], function(node) { var openingBrace = file.findNextToken(file.getLastNodeToken(node.discriminant), 'Punctuator', '{'); var prevToken = file.getPrevToken(openingBrace); assertDifferentLine(prevToken, openingBrace); }); } |
| ✓ Negative was executed (else) | /**··· * Re } |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires newline before osetting.indexOf('switch') !== -1) { |
| ✓ Was returned | /**··· * Requisetting === true || setting.indexOf('switch') !== -1) { |
| Function (anonymous_915) | |
|---|---|
| ✓ Was called | /**··· * Requires newline before opening curly brace of allfunction(node) { var openingBrace = file.findNextToken(file.getLastNodeToken(node.discriminant), 'Punctuator', '{'); var prevToken = file.getPrevToken(openingBrace); assertDifferentLine(prevToken, openingBrace); }); |
| Function getBlockType | |
|---|---|
| ✓ Was called | function getBlockType(node) {··· var parentNode = node.parentNode; switch (parentNode.type) { case 'IfStatement': return (parentNode.alternate === node) ? 'else' : 'if'; case 'FunctionDeclaration': case 'FunctionExpression': case 'ArrowFunctionExpression': return 'function'; case 'ForStatement': case 'ForInStatement': case 'ForOfStatement': return 'for'; case 'WhileStatement': return 'while'; case 'DoWhileStatement': return 'do'; case 'TryStatement': return (parentNode.finalizer === node) ? 'finally' : 'try'; case 'CatchClause': return 'catch'; } } |
| Branch SwitchStatement | |
|---|---|
| ✓ Was evaluated | /**··· * Rcase 'IfStatement': return (parentNode.alternate === node) ? 'else' : 'if'; |
| ✓ Was evaluated | /**··· * Rcase 'FunctionDeclaration': |
| ✓ Was evaluated | /**··· * Rcase 'FunctionExpression': |
| ✓ Was evaluated | /**··· * Rcase 'ArrowFunctionExpression': return 'function'; |
| ✓ Was evaluated | /**··· * Rcase 'ForStatement': |
| ✓ Was evaluated | /**··· * Rcase 'ForInStatement': |
| ✓ Was evaluated | /**··· * Rcase 'ForOfStatement': return 'for'; |
| ✓ Was evaluated | /**··· * Rcase 'WhileStatement': return 'while'; |
| ✓ Was evaluated | /**··· * Rcase 'DoWhileStatement': return 'do'; |
| ✓ Was evaluated | /**··· * Rcase 'TryStatement': return (parentNode.finalizer === node) ? 'finally' : 'try'; |
| ✓ Was evaluated | /**··· * Rcase 'CatchClause': return 'catch'; |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | /**··· * Requires newline before opening curly brace of'else' : 'if'; |
| ✓ Negative was returned (: ...) | /**··· * Requires newline before opening curly brace of all bloc'if'; |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | /**··· * Requires newline before opening curly brace of'finally' : 'try'; |
| ✓ Negative was returned (: ...) | /**··· * Requires newline before opening curly brace of all block s'try'; |
| Function (anonymous_917) | |
|---|---|
| ✓ Was called | /**··· * Requires ufunction() {}; |
| Function (anonymous_918) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); this._radixMap = { 2: 'binary', 8: 'octal', 16: 'hexadecimal' }; }, |
| Function (anonymous_919) | |
|---|---|
| ✓ Was called | /**··· * Requires usefunction() { return 'requireNumericLiterals'; }, |
| Function (anonymous_920) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var radixMap = this._radixMap; file.iterateNodesByType(['CallExpression'], function(node) { // don't check for parseInt(1) if (node.arguments.length !== 2) { return; } // only error if the radix is 2, 8, or 16 var radixName = radixMap[node.arguments[1].value]; if (node.callee.type === 'Identifier' && node.callee.name === 'parseInt' && radixName ) { errors.add('Use ' + radixName + ' literals instead of parseInt', node.loc.start); } }); } |
| Function (anonymous_921) | |
|---|---|
| ✓ Was called | /**··· * Requires use of binary, hexadecimal, and octafunction(node) { // don't check for parseInt(1) if (node.arguments.length !== 2) { return; } // only error if the radix is 2, 8, or 16 var radixName = radixMap[node.arguments[1].value]; if (node.callee.type === 'Identifier' && node.callee.name === 'parseInt' && radixName ) { errors.add('Use ' + radixName + ' literals instead of parseInt', node.loc.start); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires use of binary, hexadecimal, a{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir // only error if the radix is 2, 8, or 16 |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Require{ errors.add('Use ' + radixName + ' literals instead of parseInt', node.loc.start); } |
| ✓ Negative was executed (else) | /**··· * Requir }); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires radixName |
| ✓ Was returned | /**··· * Requires node.callee.type === 'Identifier' && node.callee.name === 'parseInt' && |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires node.callee.name === 'parseInt' && |
| ✓ Was returned | /**··· * Requires node.callee.type === 'Identifier' && |
| Function (anonymous_922) | |
|---|---|
| ✓ Was called | /**··· * Requires vfunction() {}; |
| Function (anonymous_923) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(option) { var isTrue = option === true; assert( isTrue || (typeof option === 'object' && Array.isArray(option.allExcept)), this.getOptionName() + ' requires the value `true` ' + 'or an object with an `allExcept` array property' ); this._propertyExceptions = !isTrue && option.allExcept || []; }, |
| Branch LogicalExpression | |
|---|---|
| ✗ Was not returned | /**··· * Requires variabltypeof option === 'object' && Array.isArray(option.allExcept)), |
| ✓ Was returned | /**··· * RequiisTrue || (typeof option === 'object' && Array.isArray(option.allExcept)), |
| Branch LogicalExpression | |
| ✗ Was not returned | /**··· * Requires variable declarations from objects viArray.isArray(option.allExcept)), |
| ✗ Was not returned | /**··· * Requires variabltypeof option === 'object' && Array.isArray(option.allExcept)), |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires variable declarations from objects via destructuri[]; |
| ✗ Was not returned | /**··· * Requires variable declaratio!isTrue && option.allExcept || []; |
| Branch LogicalExpression | |
| ✗ Was not returned | /**··· * Requires variable declarations from objoption.allExcept || []; |
| ✓ Was returned | /**··· * Requires variable declaratio!isTrue && option.allExcept || []; |
| Function (anonymous_924) | |
|---|---|
| ✓ Was called | /**··· * Requires varfunction() { return 'requireObjectDestructuring'; }, |
| Function (anonymous_925) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var propertyExceptions = this._propertyExceptions; file.iterateNodesByType('VariableDeclaration', function(node) { node.declarations.forEach(function(declaration) { var declarationId = declaration.id || {}; var declarationInit = declaration.init || {}; if (declarationId.type !== 'Identifier' || declarationInit.type !== 'MemberExpression') { return; } var propertyName = declarationInit.property && declarationInit.property.name; if (declarationId.name === propertyName && propertyExceptions.indexOf(propertyName) < 0) { errors.add('Property assignments should use destructuring', node.loc.start); } }); }); } |
| Function (anonymous_926) | |
|---|---|
| ✓ Was called | /**··· * Requires variable declarations from objects via function(node) { node.declarations.forEach(function(declaration) { var declarationId = declaration.id || {}; var declarationInit = declaration.init || {}; if (declarationId.type !== 'Identifier' || declarationInit.type !== 'MemberExpression') { return; } var propertyName = declarationInit.property && declarationInit.property.name; if (declarationId.name === propertyName && propertyExceptions.indexOf(propertyName) < 0) { errors.add('Property assignments should use destructuring', node.loc.start); } }); }); |
| Function (anonymous_927) | |
|---|---|
| ✓ Was called | /**··· * Requires variable declarations function(declaration) { var declarationId = declaration.id || {}; var declarationInit = declaration.init || {}; if (declarationId.type !== 'Identifier' || declarationInit.type !== 'MemberExpression') { return; } var propertyName = declarationInit.property && declarationInit.property.name; if (declarationId.name === propertyName && propertyExceptions.indexOf(propertyName) < 0) { errors.add('Property assignments should use destructuring', node.loc.start); } }); |
| Branch LogicalExpression | |
|---|---|
| ✗ Was not returned | /**··· * Requires variable declarations from objects via{}; |
| ✓ Was returned | /**··· * Requires variable declarationdeclaration.id || {}; |
| Branch LogicalExpression | |
|---|---|
| ✗ Was not returned | /**··· * Requires variable declarations from objects via des{}; |
| ✓ Was returned | /**··· * Requires variable declarations declaration.init || {}; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires variable declarations from objects via destructuring * * Type: `Boolean` * * Value: { return; } |
| ✓ Negative was executed (else) | /**··· * Requires v var propertyName = declarationInit.property && declarationInit.property.name; |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires variable declarations from objects via destdeclarationInit.type !== 'MemberExpression') { |
| ✓ Was returned | /**··· * Requires varideclarationId.type !== 'Identifier' || declarationInit.type !== 'MemberExpression') { |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires variable declarations from objects via destructdeclarationInit.property.name; |
| ✗ Was not returned | /**··· * Requires variable declaratiodeclarationInit.property && declarationInit.property.name; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires variable declarations from objects via destructuri{ errors.add('Property assignments should use destructuring', node.loc.start); } |
| ✗ Negative was not executed (else) | /**··· * Requires v }); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires varipropertyExceptions.indexOf(propertyName) < 0) { |
| ✗ Was not returned | /**··· * Requires varideclarationId.name === propertyName && |
| Function (anonymous_928) | |
|---|---|
| ✓ Was called | /**··· * Requires pfunction() {}; |
| Function (anonymous_929) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { assert( options === true || Array.isArray(options.allExcept), this.getOptionName() + ' option requires a true value or an object of exceptions' ); this._isSameLine = false; if (Array.isArray(options.allExcept)) { this._isSameLine = options.allExcept[0] === 'sameLine'; } }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires placing object kArray.isArray(options.allExcept), |
| ✓ Was returned | /**··· * Requioptions === true || Array.isArray(options.allExcept), |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires placing object keys on new lin{ this._isSameLine = options.allExcept[0] === 'sameLine'; } |
| ✓ Negative was executed (else) | /**··· * Re }, |
| Function (anonymous_930) | |
|---|---|
| ✓ Was called | /**··· * Requires plafunction() { return 'requireObjectKeysOnNewLine'; }, |
| Function (anonymous_931) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var message = 'Object keys must go on a new line'; var isSameLine = this._isSameLine; if (isSameLine) { message = 'Object keys must go on a new line if they aren\'t all on the same line'; } file.iterateNodesByType('ObjectExpression', function(node) { var firstKeyToken; var lastValueToken; if (isSameLine) { if (node.properties.length > 1) { firstKeyToken = file.getFirstNodeToken(node.properties[0].key); lastValueToken = file.getLastNodeToken(node.properties[node.properties.length - 1].value); if (firstKeyToken.loc.end.line === lastValueToken.loc.start.line) { // It's ok, all keys and values are on the same line. return; } } } for (var i = 1; i < node.properties.length; i++) { lastValueToken = file.getLastNodeToken(node.properties[i - 1].value); var comma = file.findNextToken(lastValueToken, 'Punctuator', ','); firstKeyToken = file.getFirstNodeToken(node.properties[i].key); errors.assert.differentLine({ token: comma, nextToken: firstKeyToken, message: message }); } }); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires placing { message = 'Object keys must go on a new line if they aren\'t all on the same line'; } |
| ✓ Negative was executed (else) | /**··· * Re file.iterateNodesByType('ObjectExpression', function(node) { |
| Function (anonymous_932) | |
|---|---|
| ✓ Was called | /**··· * Requires placing object keys on new line * function(node) { var firstKeyToken; var lastValueToken; if (isSameLine) { if (node.properties.length > 1) { firstKeyToken = file.getFirstNodeToken(node.properties[0].key); lastValueToken = file.getLastNodeToken(node.properties[node.properties.length - 1].value); if (firstKeyToken.loc.end.line === lastValueToken.loc.start.line) { // It's ok, all keys and values are on the same line. return; } } } for (var i = 1; i < node.properties.length; i++) { lastValueToken = file.getLastNodeToken(node.properties[i - 1].value); var comma = file.findNextToken(lastValueToken, 'Punctuator', ','); firstKeyToken = file.getFirstNodeToken(node.properties[i].key); errors.assert.differentLine({ token: comma, nextToken: firstKeyToken, message: message }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires placing obje{ if (node.properties.length > 1) { firstKeyToken = file.getFirstNodeToken(node.properties[0].key); lastValueToken = file.getLastNodeToken(node.properties[node.properties.length - 1].value); if (firstKeyToken.loc.end.line === lastValueToken.loc.start.line) { // It's ok, all keys and values are on the same line. return; } } } |
| ✓ Negative was executed (else) | /**··· * Requir for (var i = 1; i < node.properties.length; i++) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires placing object keys on new line { firstKeyToken = file.getFirstNodeToken(node.properties[0].key); lastValueToken = file.getLastNodeToken(node.properties[node.properties.length - 1].value); if (firstKeyToken.loc.end.line === lastValueToken.loc.start.line) { // It's ok, all keys and values are on the same line. return; } } |
| ✓ Negative was executed (else) | /**··· * Requires p } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires placing object keys on new line * * Types: `Boolean` or `Object` * { // It's ok, all keys and values are on the same line. return; } |
| ✓ Negative was executed (else) | /**··· * Requires placi } |
| Function (anonymous_933) | |
|---|---|
| ✓ Was called | /**··· * Requires ofunction() {}; |
| Function (anonymous_934) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(operators) { var isTrue = operators === true; assert( Array.isArray(operators) || isTrue, this.getOptionName() + ' option requires array value or true value' ); if (isTrue) { operators = defaultOperators; } this._operatorIndex = {}; for (var i = 0, l = operators.length; i < l; i++) { this._operatorIndex[operators[i]] = true; } }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires operators to appear befoisTrue, |
| ✓ Was returned | /**··· * RequiArray.isArray(operators) || isTrue, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires oper{ operators = defaultOperators; } |
| ✓ Negative was executed (else) | /**··· * Re this._operatorIndex = {}; |
| Function (anonymous_935) | |
|---|---|
| ✓ Was called | /**··· * Requires opefunction() { return 'requireOperatorBeforeLineBreak'; }, |
| Function (anonymous_936) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var operators = this._operatorIndex; var throughTokens = ['?', ',']; function errorIfApplicable(operatorToken) { errors.assert.sameLine({ token: file.getPrevToken(operatorToken), nextToken: operatorToken, message: 'Operator ' + operatorToken.value + ' should not be on a new line', stickToPreviousToken: true }); } throughTokens = throughTokens.filter(function(operator) { return operators[operator]; }); if (throughTokens.length) { file.iterateTokensByType('Punctuator', function(token) { var operator = token.value; if (throughTokens.every(function() { return throughTokens.indexOf(operator) >= 0; })) { errorIfApplicable(token); } }); } file.iterateNodesByType( ['BinaryExpression', 'AssignmentExpression', 'LogicalExpression'], function(node) { var operator = node.operator; if (!operators[operator]) { return; } var nextToken = file.getFirstNodeToken(node.argument || node.right); var token = file.findPrevOperatorToken(nextToken, operator); errorIfApplicable(token); } ); } |
| Function errorIfApplicable | |
|---|---|
| ✓ Was called | /**··· * Rfunction errorIfApplicable(operatorToken) { errors.assert.sameLine({ token: file.getPrevToken(operatorToken), nextToken: operatorToken, message: 'Operator ' + operatorToken.value + ' should not be on a new line', stickToPreviousToken: true }); } |
| Function (anonymous_938) | |
|---|---|
| ✓ Was called | /**··· * Requires operators to appear before lifunction(operator) { return operators[operator]; }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires operators to appea{ file.iterateTokensByType('Punctuator', function(token) { var operator = token.value; if (throughTokens.every(function() { return throughTokens.indexOf(operator) >= 0; })) { errorIfApplicable(token); } }); } |
| ✓ Negative was executed (else) | /**··· * Re file.iterateNodesByType( |
| Function (anonymous_939) | |
|---|---|
| ✓ Was called | /**··· * Requires operators to appear before line brefunction(token) { var operator = token.value; if (throughTokens.every(function() { return throughTokens.indexOf(operator) >= 0; })) { errorIfApplicable(token); } }); |
| Function (anonymous_940) | |
|---|---|
| ✓ Was called | /**··· * Requires operators to appear befofunction() { return throughTokens.indexOf(operator) >= 0; })) { |
| Branch IfStatement | |
| ✓ Positive was executed (if) | /**··· * Requires oper{ errorIfApplicable(token); } |
| ✓ Negative was executed (else) | /**··· * Requires o }); |
| Function (anonymous_941) | |
|---|---|
| ✓ Was called | /**··· * Requifunction(node) { var operator = node.operator; if (!operators[operator]) { return; } var nextToken = file.getFirstNodeToken(node.argument || node.right); var token = file.findPrevOperatorToken(nextToken, operator); errorIfApplicable(token); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires operators to appear before{ return; } |
| ✓ Negative was executed (else) | /**··· * Requires o var nextToken = file.getFirstNodeToken(node.argument || node.right); |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires operators to appear before line breaks and not after. *node.right); |
| ✗ Was not returned | /**··· * Requires operators to appear before line breaks node.argument || node.right); |
| Function (anonymous_942) | |
|---|---|
| ✓ Was called | /**··· * Requires afunction() {}; |
| Function (anonymous_943) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(requirePaddingNewLineAfterVariableDeclaration) { assert( requirePaddingNewLineAfterVariableDeclaration === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_944) | |
|---|---|
| ✓ Was called | /**··· * Requires an function() { return 'requirePaddingNewLineAfterVariableDeclaration'; }, |
| Function (anonymous_945) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { file.iterateNodesByType('VariableDeclaration', function(node) { if (node.parentNode.type === 'ForStatement' || node.parentNode.type === 'ForInStatement' || node.parentNode.type === 'ForOfStatement') { return; } var endOfDeclaration = file.getLastNodeToken(node); var nextToken = file.getNextToken(endOfDeclaration); // check export declaration if (nextToken.value === 'export') { nextToken = file.getNextToken(nextToken); } if (nextToken.value in {'var': true, 'let': true, 'const': true}) { return; } if (nextToken.value === '}') { return; } if (nextToken.type === 'EOF') { return; } errors.assert.linesBetween({ atLeast: 2, token: endOfDeclaration, nextToken: nextToken }); }); } |
| Function (anonymous_946) | |
|---|---|
| ✓ Was called | /**··· * Requires an extra blank newline after var declarfunction(node) { if (node.parentNode.type === 'ForStatement' || node.parentNode.type === 'ForInStatement' || node.parentNode.type === 'ForOfStatement') { return; } var endOfDeclaration = file.getLastNodeToken(node); var nextToken = file.getNextToken(endOfDeclaration); // check export declaration if (nextToken.value === 'export') { nextToken = file.getNextToken(nextToken); } if (nextToken.value in {'var': true, 'let': true, 'const': true}) { return; } if (nextToken.value === '}') { return; } if (nextToken.type === 'EOF') { return; } errors.assert.linesBetween({ atLeast: 2, token: endOfDeclaration, nextToken: nextToken }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires an extra blank newline after var declaratio{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir var endOfDeclaration = file.getLastNodeToken(node); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires node.parentNode.type === 'ForOfStatement') { |
| ✓ Was returned | /**··· * Requires node.parentNode.type === 'ForStatement' || node.parentNode.type === 'ForInStatement' || |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires node.parentNode.type === 'ForInStatement' || |
| ✓ Was returned | /**··· * Requires node.parentNode.type === 'ForStatement' || |
| Branch IfStatement | |
|---|---|
| ✗ Positive was not executed (if) | /**··· * Requires an extra blank newline after v{ nextToken = file.getNextToken(nextToken); } |
| ✓ Negative was executed (else) | /**··· * Requir if (nextToken.value in {'var': true, 'let': true, 'const': true}) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires an extra blank newline after var declarations, as long * as i{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir if (nextToken.value === '}') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires an extra blank newline af{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir if (nextToken.type === 'EOF') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires an extra blank newline aft{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir errors.assert.linesBetween({ |
| Function isException | |
|---|---|
| ✓ Was called | function isException(parent, exceptions) {··· var grandpa = parent.parentNode; // Check if this block is used in call or array expression if (grandpa && exceptions[grandpa.type]) { return true; } return false; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires newline after blocks * * Ty{ return true; } |
| ✓ Negative was executed (else) | /**··· return false; |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires newexceptions[grandpa.type]) { |
| ✓ Was returned | /**··· * Rgrandpa && exceptions[grandpa.type]) { |
| Function (anonymous_948) | |
|---|---|
| ✓ Was called | /**··· * Requires nfunction() {}; |
| Function (anonymous_949) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(value) { this.exceptions = { 'CallExpression': false, 'NewExpression': false, 'ArrayExpression': false, 'Property': false }; var optionName = this.getOptionName(); if (typeof value === 'object') { assert(Array.isArray(value.allExcept), optionName + ' option requires "allExcept" ' + 'to be an array'); assert(value.allExcept.length > 0, optionName + ' option requires "allExcept" ' + 'to have at least one item or be set to `true`'); value.allExcept.forEach(function(except) { if (except === 'inCallExpressions') { this.exceptions.CallExpression = true; } else if (except === 'inNewExpressions') { this.exceptions.NewExpression = true; } else if (except === 'inArrayExpressions') { this.exceptions.ArrayExpression = true; } else if (except === 'inProperties') { this.exceptions.Property = true; } else { assert(false, optionName + ' option requires "allExcept" to only have ' + 'one of "inCallExpressions", "inNewExpressions", "inArrayExpressions" or "inProperties'); } }, this); } else { assert(value === true, optionName + ' option requires true value or object' ); } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires newline after blocks *{ assert(Array.isArray(value.allExcept), optionName + ' option requires "allExcept" ' + 'to be an array'); assert(value.allExcept.length > 0, optionName + ' option requires "allExcept" ' + 'to have at least one item or be set to `true`'); value.allExcept.forEach(function(except) { if (except === 'inCallExpressions') { this.exceptions.CallExpression = true; } else if (except === 'inNewExpressions') { this.exceptions.NewExpression = true; } else if (except === 'inArrayExpressions') { this.exceptions.ArrayExpression = true; } else if (except === 'inProperties') { this.exceptions.Property = true; } else { assert(false, optionName + ' option requires "allExcept" to only have ' + 'one of "inCallExpressions", "inNewExpressions", "inArrayExpressions" or "inProperties'); } }, this); } else { |
| ✓ Negative was executed (else) | /**··· * Requires{ assert(value === true, optionName + ' option requires true value or object' ); } |
| Function (anonymous_950) | |
|---|---|
| ✓ Was called | /**··· * Requires newline after blocksfunction(except) { if (except === 'inCallExpressions') { this.exceptions.CallExpression = true; } else if (except === 'inNewExpressions') { this.exceptions.NewExpression = true; } else if (except === 'inArrayExpressions') { this.exceptions.ArrayExpression = true; } else if (except === 'inProperties') { this.exceptions.Property = true; } else { assert(false, optionName + ' option requires "allExcept" to only have ' + 'one of "inCallExpressions", "inNewExpressions", "inArrayExpressions" or "inProperties'); } }, this); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires newline after blocks * * Type: `Bo{ this.exceptions.CallExpression = true; } else if (except === 'inNewExpressions') { |
| ✓ Negative was executed (else) | /**··· * Requires newlineif (except === 'inNewExpressions') { this.exceptions.NewExpression = true; } else if (except === 'inArrayExpressions') { this.exceptions.ArrayExpression = true; } else if (except === 'inProperties') { this.exceptions.Property = true; } else { assert(false, optionName + ' option requires "allExcept" to only have ' + 'one of "inCallExpressions", "inNewExpressions", "inArrayExpressions" or "inProperties'); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires newline after blocks * * Type: `Boolean`{ this.exceptions.NewExpression = true; } else if (except === 'inArrayExpressions') { |
| ✓ Negative was executed (else) | /**··· * Requires newlineif (except === 'inArrayExpressions') { this.exceptions.ArrayExpression = true; } else if (except === 'inProperties') { this.exceptions.Property = true; } else { assert(false, optionName + ' option requires "allExcept" to only have ' + 'one of "inCallExpressions", "inNewExpressions", "inArrayExpressions" or "inProperties'); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires newline after blocks * * Type: `Boolean` o{ this.exceptions.ArrayExpression = true; } else if (except === 'inProperties') { |
| ✓ Negative was executed (else) | /**··· * Requires newlineif (except === 'inProperties') { this.exceptions.Property = true; } else { assert(false, optionName + ' option requires "allExcept" to only have ' + 'one of "inCallExpressions", "inNewExpressions", "inArrayExpressions" or "inProperties'); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires newline after blocks * * Type: `Bool{ this.exceptions.Property = true; } else { |
| ✓ Negative was executed (else) | /**··· * Requires newline{ assert(false, optionName + ' option requires "allExcept" to only have ' + 'one of "inCallExpressions", "inNewExpressions", "inArrayExpressions" or "inProperties'); } |
| Function (anonymous_951) | |
|---|---|
| ✓ Was called | /**··· * Requires newfunction() { return 'requirePaddingNewLinesAfterBlocks'; }, |
| Function (anonymous_952) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { file.iterateNodesByType('BlockStatement', (function(node) { var endToken = file.getLastNodeToken(node); var parentNode = node.parentNode; if (isException(parentNode, this.exceptions)) { return; } var nextToken = file.getNextToken(endToken); while (nextToken.type !== 'EOF') { var excludeValues = excludes[parentNode.type]; if (excludeValues && excludeValues.indexOf(nextToken.value) !== -1) { return; } if (endToken.loc.end.line === nextToken.loc.start.line) { endToken = nextToken; nextToken = file.getNextToken(nextToken); continue; } if (nextToken.type === 'Punctuator' && ( nextToken.value === '}' || nextToken.value === ']' || nextToken.value === '>' || nextToken.value === ')') ) { return; } errors.assert.linesBetween({ token: endToken, nextToken: nextToken, atLeast: 2, message: 'Missing newline after block' }); return; } }).bind(this)); } |
| Function (anonymous_953) | |
|---|---|
| ✓ Was called | /**··· * Requires newline after blocks * * Type: `Bfunction(node) { var endToken = file.getLastNodeToken(node); var parentNode = node.parentNode; if (isException(parentNode, this.exceptions)) { return; } var nextToken = file.getNextToken(endToken); while (nextToken.type !== 'EOF') { var excludeValues = excludes[parentNode.type]; if (excludeValues && excludeValues.indexOf(nextToken.value) !== -1) { return; } if (endToken.loc.end.line === nextToken.loc.start.line) { endToken = nextToken; nextToken = file.getNextToken(nextToken); continue; } if (nextToken.type === 'Punctuator' && ( nextToken.value === '}' || nextToken.value === ']' || nextToken.value === '>' || nextToken.value === ')') ) { return; } errors.assert.linesBetween({ token: endToken, nextToken: nextToken, atLeast: 2, message: 'Missing newline after block' }); return; } }).bind(this)); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires newline after blocks * * Type: `Boolean`{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir var nextToken = file.getNextToken(endToken); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires newline after blocks * * Type: `Boolean` or `Object` * * Values:{ return; } |
| ✓ Negative was executed (else) | /**··· * Requires n if (endToken.loc.end.line === nextToken.loc.start.line) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires newline after blocks excludeValues.indexOf(nextToken.value) !== -1) { |
| ✗ Was not returned | /**··· * Requires newlexcludeValues && excludeValues.indexOf(nextToken.value) !== -1) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires newline after blocks * * Type: `Boolean` or `Object` { endToken = nextToken; nextToken = file.getNextToken(nextToken); continue; } |
| ✓ Negative was executed (else) | /**··· * Requires n if (nextToken.type === 'Punctuator' && ( |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires ne{ return; } |
| ✓ Negative was executed (else) | /**··· * Requires n errors.assert.linesBetween({ |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires newlnextToken.value === '}' || nextToken.value === ']' || nextToken.value === '>' || nextToken.value === ')') |
| ✓ Was returned | /**··· * Requires newlnextToken.type === 'Punctuator' && ( |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires newlnextToken.value === ')') |
| ✓ Was returned | /**··· * Requires newlnextToken.value === '}' || nextToken.value === ']' || nextToken.value === '>' || |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires newlnextToken.value === '>' || |
| ✓ Was returned | /**··· * Requires newlnextToken.value === '}' || nextToken.value === ']' || |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires newlnextToken.value === ']' || |
| ✓ Was returned | /**··· * Requires newlnextToken.value === '}' || |
| Function (anonymous_954) | |
|---|---|
| ✓ Was called | /**··· * Requires afunction() {}; |
| Function (anonymous_955) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { if (typeof options !== 'object') { assert( options === true, this.getOptionName() + ' option requires either a true value or an object' ); var _options = {allExcept: []}; return this.configure(_options); } if (Array.isArray(options.allExcept)) { this._exceptRequire = options.allExcept.indexOf('require') > -1; } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires a blank line after `'use { assert( options === true, this.getOptionName() + ' option requires either a true value or an object' ); var _options = {allExcept: []}; return this.configure(_options); } |
| ✓ Negative was executed (else) | /**··· * Re if (Array.isArray(options.allExcept)) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires a blank line after `'use stric{ this._exceptRequire = options.allExcept.indexOf('require') > -1; } |
| ✗ Negative was not executed (else) | /**··· * Re }, |
| Function (anonymous_956) | |
|---|---|
| ✓ Was called | /**··· * Requires a bfunction() { return 'requirePaddingNewLinesAfterUseStrict'; }, |
| Function (anonymous_957) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var exceptRequire = this._exceptRequire; file.iterateNodesByType('ExpressionStatement', function(node) { var expression = node.expression; if (expression.type !== 'Literal' || expression.value !== 'use strict') { return; } var endOfNode = file.getLastNodeToken(node); if (exceptRequire) { var requireToken = file.findNextToken(endOfNode, 'Identifier', 'require'); if (requireToken && node.loc.start.line + 1 === requireToken.loc.start.line) { // Ensure the detected require is the first declaration of this line var keywordToken = file.getNextToken(endOfNode, { includeComments: true }); var identifierToken = file.getNextToken(file.getLastNodeToken(keywordToken), { includeComments: true }); var punctuatorToken = file.getNextToken(file.getLastNodeToken(identifierToken), { includeComments: true }); requireToken = file.getNextToken(file.getLastNodeToken(punctuatorToken), { includeComments: true }); if ( keywordToken.type === 'Keyword' && identifierToken.type === 'Identifier' && punctuatorToken.type === 'Punctuator' && requireToken.type === 'Identifier' && requireToken.value === 'require' ) { return; } } } var nextToken = file.getNextToken(endOfNode, { includeComments: true }); errors.assert.linesBetween({ atLeast: 2, token: endOfNode, nextToken: nextToken }); }); } |
| Function (anonymous_958) | |
|---|---|
| ✓ Was called | /**··· * Requires a blank line after `'use strict';` statfunction(node) { var expression = node.expression; if (expression.type !== 'Literal' || expression.value !== 'use strict') { return; } var endOfNode = file.getLastNodeToken(node); if (exceptRequire) { var requireToken = file.findNextToken(endOfNode, 'Identifier', 'require'); if (requireToken && node.loc.start.line + 1 === requireToken.loc.start.line) { // Ensure the detected require is the first declaration of this line var keywordToken = file.getNextToken(endOfNode, { includeComments: true }); var identifierToken = file.getNextToken(file.getLastNodeToken(keywordToken), { includeComments: true }); var punctuatorToken = file.getNextToken(file.getLastNodeToken(identifierToken), { includeComments: true }); requireToken = file.getNextToken(file.getLastNodeToken(punctuatorToken), { includeComments: true }); if ( keywordToken.type === 'Keyword' && identifierToken.type === 'Identifier' && punctuatorToken.type === 'Punctuator' && requireToken.type === 'Identifier' && requireToken.value === 'require' ) { return; } } } var nextToken = file.getNextToken(endOfNode, { includeComments: true }); errors.assert.linesBetween({ atLeast: 2, token: endOfNode, nextToken: nextToken }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires a blank line after `'use strict';` statements * * Values: * - `t{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir var endOfNode = file.getLastNodeToken(node); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires a blank line after `'use strict';expression.value !== 'use strict') { |
| ✓ Was returned | /**··· * Requires expression.type !== 'Literal' || expression.value !== 'use strict') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires a blank line af{ var requireToken = file.findNextToken(endOfNode, 'Identifier', 'require'); if (requireToken && node.loc.start.line + 1 === requireToken.loc.start.line) { // Ensure the detected require is the first declaration of this line var keywordToken = file.getNextToken(endOfNode, { includeComments: true }); var identifierToken = file.getNextToken(file.getLastNodeToken(keywordToken), { includeComments: true }); var punctuatorToken = file.getNextToken(file.getLastNodeToken(identifierToken), { includeComments: true }); requireToken = file.getNextToken(file.getLastNodeToken(punctuatorToken), { includeComments: true }); if ( keywordToken.type === 'Keyword' && identifierToken.type === 'Identifier' && punctuatorToken.type === 'Punctuator' && requireToken.type === 'Identifier' && requireToken.value === 'require' ) { return; } } } |
| ✓ Negative was executed (else) | /**··· * Requir var nextToken = file.getNextToken(endOfNode, { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires a blank line after `'use strict';` statements * * Values: * - `true` for { // Ensure the detected require is the first declaration of this line var keywordToken = file.getNextToken(endOfNode, { includeComments: true }); var identifierToken = file.getNextToken(file.getLastNodeToken(keywordToken), { includeComments: true }); var punctuatorToken = file.getNextToken(file.getLastNodeToken(identifierToken), { includeComments: true }); requireToken = file.getNextToken(file.getLastNodeToken(punctuatorToken), { includeComments: true }); if ( keywordToken.type === 'Keyword' && identifierToken.type === 'Identifier' && punctuatorToken.type === 'Punctuator' && requireToken.type === 'Identifier' && requireToken.value === 'require' ) { return; } } |
| ✓ Negative was executed (else) | /**··· * Requires a } |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires a blank line after `node.loc.start.line + 1 === requireToken.loc.start.line) { |
| ✓ Was returned | /**··· * Requires a blrequireToken && node.loc.start.line + 1 === requireToken.loc.start.line) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires a blan{ return; } |
| ✓ Negative was executed (else) | /**··· * Requires a bla } |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires a blank requireToken.value === 'require' |
| ✓ Was returned | /**··· * Requires a blank keywordToken.type === 'Keyword' && identifierToken.type === 'Identifier' && punctuatorToken.type === 'Punctuator' && requireToken.type === 'Identifier' && |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires a blank requireToken.type === 'Identifier' && |
| ✗ Was not returned | /**··· * Requires a blank keywordToken.type === 'Keyword' && identifierToken.type === 'Identifier' && punctuatorToken.type === 'Punctuator' && |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires a blank punctuatorToken.type === 'Punctuator' && |
| ✗ Was not returned | /**··· * Requires a blank keywordToken.type === 'Keyword' && identifierToken.type === 'Identifier' && |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires a blank identifierToken.type === 'Identifier' && |
| ✗ Was not returned | /**··· * Requires a blank keywordToken.type === 'Keyword' && |
| Function (anonymous_959) | |
|---|---|
| ✓ Was called | /**··· * Requires nfunction() {}; |
| Function (anonymous_960) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(value) { assert( value === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_961) | |
|---|---|
| ✓ Was called | /**··· * Requires newfunction() { return 'requirePaddingNewLinesBeforeExport'; }, |
| Function (anonymous_962) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { file.iterateNodesByType('AssignmentExpression', function(node) { var left = node.left; if (!( left.object && left.object.name === 'module' && left.property && left.property.name === 'exports')) { return; } var firstToken = file.getFirstNodeToken(node); var prevToken = file.getPrevToken(firstToken); errors.assert.linesBetween({ atLeast: 2, token: prevToken, nextToken: firstToken, message: 'Missing newline before export' }); }); } |
| Function (anonymous_963) | |
|---|---|
| ✓ Was called | /**··· * Requires newline before module.exports * * Typefunction(node) { var left = node.left; if (!( left.object && left.object.name === 'module' && left.property && left.property.name === 'exports')) { return; } var firstToken = file.getFirstNodeToken(node); var prevToken = file.getPrevToken(firstToken); errors.assert.linesBetween({ atLeast: 2, token: prevToken, nextToken: firstToken, message: 'Missing newline before export' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires newline before module.exports * *{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir var firstToken = file.getFirstNodeToken(node); |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires left.property.name === 'exports')) { |
| ✓ Was returned | /**··· * Requires left.object && left.object.name === 'module' && left.property && |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires left.property && |
| ✓ Was returned | /**··· * Requires left.object && left.object.name === 'module' && |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires left.object.name === 'module' && |
| ✗ Was not returned | /**··· * Requires left.object && |
| Function (anonymous_964) | |
|---|---|
| ✓ Was called | /**··· * Requires afunction() { }; |
| Function (anonymous_965) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(keywords) { assert(Array.isArray(keywords) || keywords === true, this.getOptionName() + ' option requires array or true value'); if (keywords === true) { keywords = defaultKeywords; } this._keywords = keywords; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires an empty line above the spkeywords === true, |
| ✓ Was returned | /**··· * RequiresArray.isArray(keywords) || keywords === true, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires an empty line a{ keywords = defaultKeywords; } |
| ✓ Negative was executed (else) | /**··· * Re this._keywords = keywords; |
| Function (anonymous_966) | |
|---|---|
| ✓ Was called | /**··· * Requires an function() { return 'requirePaddingNewlinesBeforeKeywords'; }, |
| Function (anonymous_967) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var excludedTokens = [':', ',', '(', '=']; var specialCases = { 'if': 'else' }; file.iterateTokensByTypeAndValue('Keyword', this._keywords, function(token) { var prevToken = file.getPrevToken(token); // Handle special cases listed in specialCasesToken array if (prevToken && prevToken.value === specialCases[token.value]) { return; // Allow returning a function } else if (prevToken && prevToken.value === 'return' && token.value === 'function') { return; } else if (prevToken && token.value === 'while' && file.getNodesByFirstToken(token).length === 0) { return; // Handle excludedTokens } else if (prevToken && excludedTokens.indexOf(prevToken.value) > -1) { return; } // Handle all other cases // The { character is there to handle the case of a matching token which happens to be the first // statement in a block // The ) character is there to handle the case of `if (...) matchingKeyword` in which case // requiring padding would break the statement if (prevToken && prevToken.value !== '{' && prevToken.value !== ')') { errors.assert.linesBetween({ token: prevToken, nextToken: token, atLeast: 2, message: 'Keyword `' + token.value + '` should have an empty line above it' }); } }); } |
| Function (anonymous_968) | |
|---|---|
| ✓ Was called | /**··· * Requires an empty line above the specified keywords unless thfunction(token) { var prevToken = file.getPrevToken(token); // Handle special cases listed in specialCasesToken array if (prevToken && prevToken.value === specialCases[token.value]) { return; // Allow returning a function } else if (prevToken && prevToken.value === 'return' && token.value === 'function') { return; } else if (prevToken && token.value === 'while' && file.getNodesByFirstToken(token).length === 0) { return; // Handle excludedTokens } else if (prevToken && excludedTokens.indexOf(prevToken.value) > -1) { return; } // Handle all other cases // The { character is there to handle the case of a matching token which happens to be the first // statement in a block // The ) character is there to handle the case of `if (...) matchingKeyword` in which case // requiring padding would break the statement if (prevToken && prevToken.value !== '{' && prevToken.value !== ')') { errors.assert.linesBetween({ token: prevToken, nextToken: token, atLeast: 2, message: 'Keyword `' + token.value + '` should have an empty line above it' }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires an empty line above the specified keywords unless the keywor{ return; // Allow returning a function } else if (prevToken && prevToken.value === 'return' && token.value === 'function') { |
| ✓ Negative was executed (else) | /**··· * Requires an if (prevToken && prevToken.value === 'return' && token.value === 'function') { return; } else if (prevToken && token.value === 'while' && file.getNodesByFirstToken(token).length === 0) { return; // Handle excludedTokens } else if (prevToken && excludedTokens.indexOf(prevToken.value) > -1) { return; } |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires an empty lineprevToken.value === specialCases[token.value]) { |
| ✓ Was returned | /**··· * Requires prevToken && prevToken.value === specialCases[token.value]) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires an empty line above the specified keywords unless the keyword is the first expre{ return; } else if (prevToken && token.value === 'while' && |
| ✓ Negative was executed (else) | /**··· * Requires an if (prevToken && token.value === 'while' && file.getNodesByFirstToken(token).length === 0) { return; // Handle excludedTokens } else if (prevToken && excludedTokens.indexOf(prevToken.value) > -1) { return; } |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires an empty line above the specified keywords unless thtoken.value === 'function') { |
| ✓ Was returned | /**··· * Requires an emptprevToken && prevToken.value === 'return' && token.value === 'function') { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires an empty line above prevToken.value === 'return' && token.value === 'function') { |
| ✓ Was returned | /**··· * Requires an emptprevToken && prevToken.value === 'return' && token.value === 'function') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires an empty line above the specified keywords unle{ return; // Handle excludedTokens } else if (prevToken && excludedTokens.indexOf(prevToken.value) > -1) { |
| ✓ Negative was executed (else) | /**··· * Requires an if (prevToken && excludedTokens.indexOf(prevToken.value) > -1) { return; } |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires file.getNodesByFirstToken(token).length === 0) { |
| ✓ Was returned | /**··· * Requires an emptprevToken && token.value === 'while' && |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires an empty line above token.value === 'while' && |
| ✓ Was returned | /**··· * Requires an emptprevToken && token.value === 'while' && |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires an empty line above the specified keywords unless the keyword is t{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir // Handle all other cases |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires an empty line above excludedTokens.indexOf(prevToken.value) > -1) { |
| ✓ Was returned | /**··· * Requires an emptprevToken && excludedTokens.indexOf(prevToken.value) > -1) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires an empty line above the specified keywords unless the keyword is { errors.assert.linesBetween({ token: prevToken, nextToken: token, atLeast: 2, message: 'Keyword `' + token.value + '` should have an empty line above it' }); } |
| ✓ Negative was executed (else) | /**··· * Requir }); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires an empty line above the specified keyworprevToken.value !== ')') { |
| ✓ Was returned | /**··· * Requires prevToken && prevToken.value !== '{' && prevToken.value !== ')') { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires an empty lineprevToken.value !== '{' && prevToken.value !== ')') { |
| ✓ Was returned | /**··· * Requires prevToken && prevToken.value !== '{' && prevToken.value !== ')') { |
| Function (anonymous_969) | |
|---|---|
| ✓ Was called | /**··· * Requires nfunction() {}; |
| Function (anonymous_970) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(value) { this._allowFirstAfterCurly = false; if (typeof value === 'object') { assert(typeof value.allExcept === 'string' && value.allExcept === 'firstAfterCurly', this.getOptionName() + ' option requires the "allExcept" ' + 'property to equal "firstAfterCurly"'); this._allowFirstAfterCurly = true; } else { assert(value === true, this.getOptionName() + ' option requires true value or object' ); } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires newline before line com{ assert(typeof value.allExcept === 'string' && value.allExcept === 'firstAfterCurly', this.getOptionName() + ' option requires the "allExcept" ' + 'property to equal "firstAfterCurly"'); this._allowFirstAfterCurly = true; } else { |
| ✓ Negative was executed (else) | /**··· * Requires{ assert(value === true, this.getOptionName() + ' option requires true value or object' ); } |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires newline before line comments * * Types: value.allExcept === 'firstAfterCurly', |
| ✓ Was returned | /**··· * Requires newtypeof value.allExcept === 'string' && value.allExcept === 'firstAfterCurly', |
| Function (anonymous_971) | |
|---|---|
| ✓ Was called | /**··· * Requires newfunction() { return 'requirePaddingNewLinesBeforeLineComments'; }, |
| Function (anonymous_972) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var allowFirstAfterCurly = this._allowFirstAfterCurly; file.iterateTokensByType('Line', function(comment) { if (comment.loc.start.line === 1) { return; } var firstToken = file.getFirstTokenOnLine(comment.loc.start.line); // Should not consider code and comment on the same line (#1194) if (firstToken !== null && firstToken.type !== 'EOF') { return; } var prevToken = file.getPrevToken(comment, {includeComments: true}); if (!prevToken || prevToken.type === 'Line') { return; } if (allowFirstAfterCurly && prevToken.type === 'Punctuator' && prevToken.value === '{') { return; } errors.assert.linesBetween({ token: prevToken, nextToken: comment, atLeast: 2, message: 'Line comments must be preceded with a blank line' }); }); } |
| Function (anonymous_973) | |
|---|---|
| ✓ Was called | /**··· * Requires newline before line commefunction(comment) { if (comment.loc.start.line === 1) { return; } var firstToken = file.getFirstTokenOnLine(comment.loc.start.line); // Should not consider code and comment on the same line (#1194) if (firstToken !== null && firstToken.type !== 'EOF') { return; } var prevToken = file.getPrevToken(comment, {includeComments: true}); if (!prevToken || prevToken.type === 'Line') { return; } if (allowFirstAfterCurly && prevToken.type === 'Punctuator' && prevToken.value === '{') { return; } errors.assert.linesBetween({ token: prevToken, nextToken: comment, atLeast: 2, message: 'Line comments must be preceded with a blank line' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires newline before line comments { return; } |
| ✓ Negative was executed (else) | /**··· * Requir var firstToken = file.getFirstTokenOnLine(comment.loc.start.line); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires newline before line comments * * Types: `Boolean{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir var prevToken = file.getPrevToken(comment, {includeComments: true}); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires newline before line comfirstToken.type !== 'EOF') { |
| ✓ Was returned | /**··· * Requires firstToken !== null && firstToken.type !== 'EOF') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires newline before line comments * * Types:{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir if (allowFirstAfterCurly && prevToken.type === 'Punctuator' && prevToken.value === '{') { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires newline beforeprevToken.type === 'Line') { |
| ✓ Was returned | /**··· * Requires !prevToken || prevToken.type === 'Line') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires newline before line comments * * Types: `Boolean` or `Object` * * Values: * - `{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir errors.assert.linesBetween({ |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires newline before line comments * * Types: `Boolean` or `ObjprevToken.value === '{') { |
| ✓ Was returned | /**··· * Requires allowFirstAfterCurly && prevToken.type === 'Punctuator' && prevToken.value === '{') { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires newline before line commprevToken.type === 'Punctuator' && prevToken.value === '{') { |
| ✓ Was returned | /**··· * Requires allowFirstAfterCurly && prevToken.type === 'Punctuator' && prevToken.value === '{') { |
| Function (anonymous_974) | |
|---|---|
| ✓ Was called | /**··· * Requires bfunction() {}; |
| Function (anonymous_975) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { var optionName = this.getOptionName(); assert( options === true || typeof options === 'number' || typeof options === 'object', optionName + ' option requires the value true, an Integer or an object' ); this._checkOpen = true; this._checkClose = true; this._minLines = 0; if (typeof options === 'object') { assert(options.allExcept || options.open || options.close, optionName + 'option requires either "open", "close", "allExcept"'); if (options.allExcept) { assert(Array.isArray(options.allExcept), optionName + ' option requires "allExcept" to be an array'); assert(options.allExcept.length > 0, optionName + ' option requires "allExcept" to have at least one ' + 'item or be set to `true`'); this._exceptConditionals = options.allExcept.indexOf('conditionals') > -1; this._exceptFunctions = options.allExcept.indexOf('functions') > -1; } if (options.open || options.close) { assert(typeof options.open === 'boolean' && typeof options.close === 'boolean', this.getOptionName() + ' option requires the "open" and "close" ' + 'properties to be booleans'); this._checkOpen = options.open; this._checkClose = options.close; } } else if (typeof options === 'number') { this._minLines = options; } else { assert(options === true, this.getOptionName() + ' option requires either a true value, or an object'); } }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires blocks to begin and end with 2 newlines * * Ttypeof options === 'object', |
| ✓ Was returned | /**··· * Requioptions === true || typeof options === 'number' || typeof options === 'object', |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires blocks to begin typeof options === 'number' || typeof options === 'object', |
| ✓ Was returned | /**··· * Requioptions === true || typeof options === 'number' || typeof options === 'object', |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires blocks to begin and end w{ assert(options.allExcept || options.open || options.close, optionName + 'option requires either "open", "close", "allExcept"'); if (options.allExcept) { assert(Array.isArray(options.allExcept), optionName + ' option requires "allExcept" to be an array'); assert(options.allExcept.length > 0, optionName + ' option requires "allExcept" to have at least one ' + 'item or be set to `true`'); this._exceptConditionals = options.allExcept.indexOf('conditionals') > -1; this._exceptFunctions = options.allExcept.indexOf('functions') > -1; } if (options.open || options.close) { assert(typeof options.open === 'boolean' && typeof options.close === 'boolean', this.getOptionName() + ' option requires the "open" and "close" ' + 'properties to be booleans'); this._checkOpen = options.open; this._checkClose = options.close; } } else if (typeof options === 'number') { |
| ✓ Negative was executed (else) | /**··· * Requiresif (typeof options === 'number') { this._minLines = options; } else { assert(options === true, this.getOptionName() + ' option requires either a true value, or an object'); } |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires blocks to begin and end with 2 newlines options.close, |
| ✓ Was returned | /**··· * Requires blooptions.allExcept || options.open || options.close, |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires blocks to begin and end options.open || options.close, |
| ✓ Was returned | /**··· * Requires blooptions.allExcept || options.open || options.close, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires blocks to begin and{ assert(Array.isArray(options.allExcept), optionName + ' option requires "allExcept" to be an array'); assert(options.allExcept.length > 0, optionName + ' option requires "allExcept" to have at least one ' + 'item or be set to `true`'); this._exceptConditionals = options.allExcept.indexOf('conditionals') > -1; this._exceptFunctions = options.allExcept.indexOf('functions') > -1; } |
| ✓ Negative was executed (else) | /**··· * Requir if (options.open || options.close) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires blocks to begin and end with 2 { assert(typeof options.open === 'boolean' && typeof options.close === 'boolean', this.getOptionName() + ' option requires the "open" and "close" ' + 'properties to be booleans'); this._checkOpen = options.open; this._checkClose = options.close; } |
| ✓ Negative was executed (else) | /**··· * Requir } else if (typeof options === 'number') { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires blocks to begin options.close) { |
| ✓ Was returned | /**··· * Requires options.open || options.close) { |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires blocks to begin and end with 2 newlines * typeof options.close === 'boolean', |
| ✓ Was returned | /**··· * Requires blocks typeof options.open === 'boolean' && typeof options.close === 'boolean', |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires blocks to begin and end with 2 n{ this._minLines = options; } else { |
| ✓ Negative was executed (else) | /**··· * Requires{ assert(options === true, this.getOptionName() + ' option requires either a true value, or an object'); } |
| Function (anonymous_976) | |
|---|---|
| ✓ Was called | /**··· * Requires blofunction() { return 'requirePaddingNewlinesInBlocks'; }, |
| Function (anonymous_977) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var minLines = this._minLines; var exceptConditionals = this._exceptConditionals; var exceptFunctions = this._exceptFunctions; var checkOpen = this._checkOpen; var checkClose = this._checkClose; file.iterateNodesByType('BlockStatement', function(node) { var openingBracket; var closingBracket; if (node.body.length <= minLines) { return; } if (exceptConditionals && node.parentNode.type === 'IfStatement' || exceptFunctions && (node.parentNode.type === 'FunctionExpression' || node.parentNode.type === 'FunctionDeclaration')) { return; } if (checkOpen === true) { openingBracket = file.getFirstNodeToken(node); errors.assert.linesBetween({ token: openingBracket, nextToken: file.getNextToken(openingBracket, {includeComments: true}), atLeast: 2, message: 'Expected a padding newline after opening curly brace' }); } if (checkClose === true) { closingBracket = file.getLastNodeToken(node); errors.assert.linesBetween({ token: file.getPrevToken(closingBracket, {includeComments: true}), nextToken: closingBracket, atLeast: 2, message: 'Expected a padding newline before closing curly brace' }); } }); } |
| Function (anonymous_978) | |
|---|---|
| ✓ Was called | /**··· * Requires blocks to begin and end with 2 newfunction(node) { var openingBracket; var closingBracket; if (node.body.length <= minLines) { return; } if (exceptConditionals && node.parentNode.type === 'IfStatement' || exceptFunctions && (node.parentNode.type === 'FunctionExpression' || node.parentNode.type === 'FunctionDeclaration')) { return; } if (checkOpen === true) { openingBracket = file.getFirstNodeToken(node); errors.assert.linesBetween({ token: openingBracket, nextToken: file.getNextToken(openingBracket, {includeComments: true}), atLeast: 2, message: 'Expected a padding newline after opening curly brace' }); } if (checkClose === true) { closingBracket = file.getLastNodeToken(node); errors.assert.linesBetween({ token: file.getPrevToken(closingBracket, {includeComments: true}), nextToken: closingBracket, atLeast: 2, message: 'Expected a padding newline before closing curly brace' }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires blocks to begin and end with 2{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir if (exceptConditionals && node.parentNode.type === 'IfStatement' || |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires blocks to begin and end with 2 newlines * * Typ{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir if (checkOpen === true) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires exceptFunctions && (node.parentNode.type === 'FunctionExpression' || node.parentNode.type === 'FunctionDeclaration')) { |
| ✓ Was returned | /**··· * Requires exceptConditionals && node.parentNode.type === 'IfStatement' || |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires blocks to begin and ennode.parentNode.type === 'IfStatement' || |
| ✓ Was returned | /**··· * Requires exceptConditionals && node.parentNode.type === 'IfStatement' || |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires blocks to begin and node.parentNode.type === 'FunctionExpression' || node.parentNode.type === 'FunctionDeclaration')) { |
| ✓ Was returned | /**··· * Requires exceptFunctions && (node.parentNode.type === 'FunctionExpression' || |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires node.parentNode.type === 'FunctionDeclaration')) { |
| ✓ Was returned | /**··· * Requires blocks to begin and node.parentNode.type === 'FunctionExpression' || |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires blocks to begin and { openingBracket = file.getFirstNodeToken(node); errors.assert.linesBetween({ token: openingBracket, nextToken: file.getNextToken(openingBracket, {includeComments: true}), atLeast: 2, message: 'Expected a padding newline after opening curly brace' }); } |
| ✓ Negative was executed (else) | /**··· * Requir if (checkClose === true) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires blocks to begin and e{ closingBracket = file.getLastNodeToken(node); errors.assert.linesBetween({ token: file.getPrevToken(closingBracket, {includeComments: true}), nextToken: closingBracket, atLeast: 2, message: 'Expected a padding newline before closing curly brace' }); } |
| ✓ Negative was executed (else) | /**··· * Requir }); |
| Function (anonymous_979) | |
|---|---|
| ✓ Was called | /**··· * Requires nfunction() {}; |
| Function (anonymous_980) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(value) { assert( value === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_981) | |
|---|---|
| ✓ Was called | /**··· * Requires newfunction() { return 'requirePaddingNewLinesInObjects'; }, |
| Function (anonymous_982) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { file.iterateNodesByType('ObjectExpression', function(node) { var openingBracket = file.getFirstNodeToken(node); var nextToken = file.getNextToken(openingBracket); if (nextToken.type === 'Punctuator' && nextToken.value === '}') { return; } errors.assert.differentLine({ token: openingBracket, nextToken: nextToken, message: 'Missing newline after opening curly brace' }); var closingBracket = file.getLastNodeToken(node); errors.assert.differentLine({ token: file.getPrevToken(closingBracket), nextToken: closingBracket, message: 'Missing newline before closing curly brace' }); }); } |
| Function (anonymous_983) | |
|---|---|
| ✓ Was called | /**··· * Requires newline inside curly braces of all ofunction(node) { var openingBracket = file.getFirstNodeToken(node); var nextToken = file.getNextToken(openingBracket); if (nextToken.type === 'Punctuator' && nextToken.value === '}') { return; } errors.assert.differentLine({ token: openingBracket, nextToken: nextToken, message: 'Missing newline after opening curly brace' }); var closingBracket = file.getLastNodeToken(node); errors.assert.differentLine({ token: file.getPrevToken(closingBracket), nextToken: closingBracket, message: 'Missing newline before closing curly brace' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires newline inside curly braces of all objects. * * Type: `Boo{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir errors.assert.differentLine({ |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires newline inside curly braces of all nextToken.value === '}') { |
| ✓ Was returned | /**··· * Requires nextToken.type === 'Punctuator' && nextToken.value === '}') { |
| Function (anonymous_984) | |
|---|---|
| ✓ Was called | /**··· * Requires pfunction() {}; |
| Function (anonymous_985) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_986) | |
|---|---|
| ✓ Was called | /**··· * Requires parfunction() { return 'requireParenthesesAroundArrowParam'; }, |
| Function (anonymous_987) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { function isWrapped(node) { var openParensToken = file.getPrevToken(file.getFirstNodeToken(node)); var closingParensToken = file.getNextToken(file.getLastNodeToken(node)); var closingTokenValue = closingParensToken ? closingParensToken.value : ''; return openParensToken.value + closingTokenValue === '()'; } file.iterateNodesByType('ArrowFunctionExpression', function(node) { var params = node.params; var firstParam = params[0]; if (params.length === 1 && !isWrapped(firstParam)) { errors.add( 'Wrap arrow function expressions in parentheses', firstParam.loc.start ); } }); } |
| Function isWrapped | |
|---|---|
| ✓ Was called | /**··· * Rfunction isWrapped(node) { var openParensToken = file.getPrevToken(file.getFirstNodeToken(node)); var closingParensToken = file.getNextToken(file.getLastNodeToken(node)); var closingTokenValue = closingParensToken ? closingParensToken.value : ''; return openParensToken.value + closingTokenValue === '()'; } |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | /**··· * Requires parentheses around arrow function expressclosingParensToken.value : ''; |
| ✗ Negative was not returned (: ...) | /**··· * Requires parentheses around arrow function expressions with a single paramete''; |
| Function (anonymous_989) | |
|---|---|
| ✓ Was called | /**··· * Requires parentheses around arrow function expressiofunction(node) { var params = node.params; var firstParam = params[0]; if (params.length === 1 && !isWrapped(firstParam)) { errors.add( 'Wrap arrow function expressions in parentheses', firstParam.loc.start ); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires parentheses around arrow function expressions w{ errors.add( 'Wrap arrow function expressions in parentheses', firstParam.loc.start ); } |
| ✓ Negative was executed (else) | /**··· * Requir }); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires parentheses around arro!isWrapped(firstParam)) { |
| ✓ Was returned | /**··· * Requires params.length === 1 && !isWrapped(firstParam)) { |
| Function (anonymous_990) | |
|---|---|
| ✓ Was called | /**··· * Requires pfunction() {}; |
| Function (anonymous_991) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_992) | |
|---|---|
| ✓ Was called | /**··· * Requires parfunction() { return 'requireParenthesesAroundIIFE'; }, |
| Function (anonymous_993) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { function isWrapped(node) { var openParensToken = file.getPrevToken(file.getFirstNodeToken(node)); var closingParensToken = file.getNextToken(file.getLastNodeToken(node)); var closingTokenValue = closingParensToken ? closingParensToken.value : ''; return openParensToken.value + closingTokenValue === '()'; } file.iterateNodesByType('CallExpression', function(node) { var inner = utils.getFunctionNodeFromIIFE(node); if (inner && !isWrapped(inner) && !isWrapped(node)) { errors.add( 'Wrap immediately invoked function expressions in parentheses', node.loc.start.line, node.loc.start.column ); } }); } |
| Function isWrapped | |
|---|---|
| ✓ Was called | /**··· * Rfunction isWrapped(node) { var openParensToken = file.getPrevToken(file.getFirstNodeToken(node)); var closingParensToken = file.getNextToken(file.getLastNodeToken(node)); var closingTokenValue = closingParensToken ? closingParensToken.value : ''; return openParensToken.value + closingTokenValue === '()'; } |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | /**··· * Requires parentheses around immediately invoked fuclosingParensToken.value : ''; |
| ✗ Negative was not returned (: ...) | /**··· * Requires parentheses around immediately invoked function expressions. * * T''; |
| Function (anonymous_995) | |
|---|---|
| ✓ Was called | /**··· * Requires parentheses around immediately invfunction(node) { var inner = utils.getFunctionNodeFromIIFE(node); if (inner && !isWrapped(inner) && !isWrapped(node)) { errors.add( 'Wrap immediately invoked function expressions in parentheses', node.loc.start.line, node.loc.start.column ); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires parentheses around immediately invoked function { errors.add( 'Wrap immediately invoked function expressions in parentheses', node.loc.start.line, node.loc.start.column ); } |
| ✓ Negative was executed (else) | /**··· * Requir }); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires parentheses around immediately!isWrapped(node)) { |
| ✓ Was returned | /**··· * Requires inner && !isWrapped(inner) && !isWrapped(node)) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires parenthes!isWrapped(inner) && !isWrapped(node)) { |
| ✓ Was returned | /**··· * Requires inner && !isWrapped(inner) && !isWrapped(node)) { |
| Function (anonymous_996) | |
|---|---|
| ✓ Was called | /**··· * Requires qfunction() { }; |
| Function (anonymous_997) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_998) | |
|---|---|
| ✓ Was called | /**··· * Requires quofunction() { return 'requireQuotedKeysInObjects'; }, |
| Function (anonymous_999) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { file.iterateNodesByType('ObjectExpression', function(node) { node.properties.forEach(function(property) { if (property.shorthand || property.method || property.kind !== 'init' || node.type === 'SpreadProperty') { return; } var key = property.key; if (!(typeof key.value === 'string' && key.type === 'Literal')) { errors.add('Object key without surrounding quotes', property.loc.start); } }); }); } |
| Function (anonymous_1000) | |
|---|---|
| ✓ Was called | /**··· * Requires quoted keys in objects. * * Type: function(node) { node.properties.forEach(function(property) { if (property.shorthand || property.method || property.kind !== 'init' || node.type === 'SpreadProperty') { return; } var key = property.key; if (!(typeof key.value === 'string' && key.type === 'Literal')) { errors.add('Object key without surrounding quotes', property.loc.start); } }); }); |
| Function (anonymous_1001) | |
|---|---|
| ✓ Was called | /**··· * Requires quoted keys in objecfunction(property) { if (property.shorthand || property.method || property.kind !== 'init' || node.type === 'SpreadProperty') { return; } var key = property.key; if (!(typeof key.value === 'string' && key.type === 'Literal')) { errors.add('Object key without surrounding quotes', property.loc.start); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires quoted keys in objects. * * Type: { return; } |
| ✓ Negative was executed (else) | /**··· * Requires q var key = property.key; |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires quotnode.type === 'SpreadProperty') { |
| ✓ Was returned | /**··· * Requires quotproperty.shorthand || property.method || property.kind !== 'init' || |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires quoted keys in objects. * * Type: `Boolean`property.kind !== 'init' || |
| ✓ Was returned | /**··· * Requires quotproperty.shorthand || property.method || property.kind !== 'init' || |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires quoted keys in objects. *property.method || property.kind !== 'init' || |
| ✓ Was returned | /**··· * Requires quotproperty.shorthand || property.method || property.kind !== 'init' || |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires quoted keys in objects. * * Type: `Boolean` * * Value: `true{ errors.add('Object key without surrounding quotes', property.loc.start); } |
| ✓ Negative was executed (else) | /**··· * Requires q }); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires quoted keys in objects. * * Type: `Bokey.type === 'Literal')) { |
| ✓ Was returned | /**··· * Requires quotedtypeof key.value === 'string' && key.type === 'Literal')) { |
| Function (anonymous_1002) | |
|---|---|
| ✓ Was called | /**··· * Requires sfunction() {}; |
| Function (anonymous_1003) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_1004) | |
|---|---|
| ✓ Was called | /**··· * Requires semfunction() { return 'requireSemicolons'; }, |
| Function (anonymous_1005) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { file.iterateNodesByType([ 'VariableDeclaration', 'ImportDeclaration', 'ExportDeclaration', 'ExportDefaultDeclaration', 'ExportNamedDeclaration', 'ExpressionStatement', 'DoWhileStatement', 'ReturnStatement', 'ThrowStatement', 'BreakStatement', 'ContinueStatement', 'DebuggerStatement', 'ClassProperty' ], function(node) { // ignore variable declaration inside for and for-in if (node.type === 'VariableDeclaration') { if ((node.parentNode.type === 'ForInStatement' && node.parentNode.left === node) || (node.parentNode.type === 'ForOfStatement' && node.parentNode.left === node) || (node.parentNode.type === 'ForStatement' && node.parentNode.init === node)) { return; } } // don't require semicolon for class and function exports if (node.type === 'ExportDefaultDeclaration' || node.type === 'ExportNamedDeclaration') { if (node.declaration) { if (node.declaration.type === 'ClassDeclaration' || node.declaration.type === 'FunctionDeclaration') { return; } } } // get last token inside node var lastToken = file.getLastNodeToken(node); var checkToken = lastToken; // if last token is not a semicolon punctuator, try to get next token in file if (checkToken && (checkToken.type !== 'Punctuator' || checkToken.value !== ';')) { checkToken = file.getNextToken(checkToken); } // check token is semicolon if (!checkToken || checkToken.type !== 'Punctuator' || checkToken.value !== ';') { var entity = lastToken || node; errors.cast({ message: 'Missing semicolon after statement', line: entity.loc.end.line, column: entity.loc.end.column, additional: entity }); } }); }, |
| Function (anonymous_1006) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(node) { // ignore variable declaration inside for and for-in if (node.type === 'VariableDeclaration') { if ((node.parentNode.type === 'ForInStatement' && node.parentNode.left === node) || (node.parentNode.type === 'ForOfStatement' && node.parentNode.left === node) || (node.parentNode.type === 'ForStatement' && node.parentNode.init === node)) { return; } } // don't require semicolon for class and function exports if (node.type === 'ExportDefaultDeclaration' || node.type === 'ExportNamedDeclaration') { if (node.declaration) { if (node.declaration.type === 'ClassDeclaration' || node.declaration.type === 'FunctionDeclaration') { return; } } } // get last token inside node var lastToken = file.getLastNodeToken(node); var checkToken = lastToken; // if last token is not a semicolon punctuator, try to get next token in file if (checkToken && (checkToken.type !== 'Punctuator' || checkToken.value !== ';')) { checkToken = file.getNextToken(checkToken); } // check token is semicolon if (!checkToken || checkToken.type !== 'Punctuator' || checkToken.value !== ';') { var entity = lastToken || node; errors.cast({ message: 'Missing semicolon after statement', line: entity.loc.end.line, column: entity.loc.end.column, additional: entity }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires semicolon after: * * * var declarat{ if ((node.parentNode.type === 'ForInStatement' && node.parentNode.left === node) || (node.parentNode.type === 'ForOfStatement' && node.parentNode.left === node) || (node.parentNode.type === 'ForStatement' && node.parentNode.init === node)) { return; } } |
| ✓ Negative was executed (else) | /**··· * Requir // don't require semicolon for class and function exports |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires semicolon after: * * * var declaration * * expression statement * * return { return; } |
| ✓ Negative was executed (else) | /**··· * Requires s } |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires semicnode.parentNode.type === 'ForStatement' && node.parentNode.init === node)) { |
| ✓ Was returned | /**··· * Requires semi(node.parentNode.type === 'ForInStatement' && node.parentNode.left === node) || (node.parentNode.type === 'ForOfStatement' && node.parentNode.left === node) || |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires semicnode.parentNode.type === 'ForOfStatement' && node.parentNode.left === node) || |
| ✓ Was returned | /**··· * Requires semicnode.parentNode.type === 'ForInStatement' && node.parentNode.left === node) || |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires semicolon after: * * * var declaration * * exprnode.parentNode.left === node) || |
| ✓ Was returned | /**··· * Requires semicnode.parentNode.type === 'ForInStatement' && node.parentNode.left === node) || |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires semicolon after: * * * var declaration * * exprnode.parentNode.left === node) || |
| ✓ Was returned | /**··· * Requires semicnode.parentNode.type === 'ForOfStatement' && node.parentNode.left === node) || |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires semicolon after: * * * var declaration * * exnode.parentNode.init === node)) { |
| ✓ Was returned | /**··· * Requires semicnode.parentNode.type === 'ForStatement' && node.parentNode.init === node)) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires semicolon after: * * * var declaration{ if (node.declaration) { if (node.declaration.type === 'ClassDeclaration' || node.declaration.type === 'FunctionDeclaration') { return; } } } |
| ✓ Negative was executed (else) | /**··· * Requir // get last token inside node |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires node.type === 'ExportNamedDeclaration') { |
| ✓ Was returned | /**··· * Requires node.type === 'ExportDefaultDeclaration' || |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires semicolon after: * *{ if (node.declaration.type === 'ClassDeclaration' || node.declaration.type === 'FunctionDeclaration') { return; } } |
| ✓ Negative was executed (else) | /**··· * Requires s } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires semicolon after: * * * var declaration * * expression { return; } |
| ✓ Negative was executed (else) | /**··· * Requires semic } |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires semicolonode.declaration.type === 'FunctionDeclaration') { |
| ✓ Was returned | /**··· * Requires semicolonode.declaration.type === 'ClassDeclaration' || |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires semicolon after: * * * var declaration * * expression statement * * return{ checkToken = file.getNextToken(checkToken); } |
| ✓ Negative was executed (else) | /**··· * Requir // check token is semicolon |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires semicolon aftercheckToken.type !== 'Punctuator' || checkToken.value !== ';')) { |
| ✗ Was not returned | /**··· * Requires checkToken && (checkToken.type !== 'Punctuator' || checkToken.value !== ';')) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires semicolon after: * * * var declaration * * exprecheckToken.value !== ';')) { |
| ✓ Was returned | /**··· * Requires semicolon aftercheckToken.type !== 'Punctuator' || checkToken.value !== ';')) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires semicolon after: * * * var declaration * * expression statement * * retur{ var entity = lastToken || node; errors.cast({ message: 'Missing semicolon after statement', line: entity.loc.end.line, column: entity.loc.end.column, additional: entity }); } |
| ✓ Negative was executed (else) | /**··· * Requir }); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires semicolon after: * * * var declaration * * exprecheckToken.value !== ';') { |
| ✓ Was returned | /**··· * Requires !checkToken || checkToken.type !== 'Punctuator' || checkToken.value !== ';') { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires semicolon aftercheckToken.type !== 'Punctuator' || checkToken.value !== ';') { |
| ✗ Was not returned | /**··· * Requires !checkToken || checkToken.type !== 'Punctuator' || checkToken.value !== ';') { |
| Branch LogicalExpression | |
|---|---|
| ✗ Was not returned | /**··· * Requires semicolon after: * * * vnode; |
| ✓ Was returned | /**··· * Requires semicolon aftlastToken || node; |
| Function (anonymous_1007) | |
|---|---|
| ✓ Was called | /**··· * Reqfunction(file, error) { var token; var entity = error.additional; var isNode = !!entity.parentNode; if (isNode) { token = file.getLastNodeToken(entity.parentNode); } else { token = file.getNextToken(entity, { includeComments: true }); } file.setWhitespaceBefore(token, ';' + file.getWhitespaceBefore(token)); } |
| Branch IfStatement | |
|---|---|
| ✗ Positive was not executed (if) | /**··· * Requires semi{ token = file.getLastNodeToken(entity.parentNode); } else { |
| ✓ Negative was executed (else) | /**··· * Requires{ token = file.getNextToken(entity, { includeComments: true }); } |
| Function (anonymous_1008) | |
|---|---|
| ✓ Was called | /**··· * Require arfunction() {}; |
| Function (anonymous_1009) | |
|---|---|
| ✓ Was called | /**··· * Require function(options) { assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_1010) | |
|---|---|
| ✓ Was called | /**··· * Require arrofunction() { return 'requireShorthandArrowFunctions'; }, |
| Function (anonymous_1011) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { file.iterateNodesByType('ArrowFunctionExpression', function(node) { var body = node.body; if (body.type === 'BlockStatement' && body.body.length === 1 && body.body[0].type === 'ReturnStatement') { errors.add( 'Use the shorthand arrow function form', node.body.loc.start ); } }); } |
| Function (anonymous_1012) | |
|---|---|
| ✓ Was called | /**··· * Require arrow functions to use an expression body whfunction(node) { var body = node.body; if (body.type === 'BlockStatement' && body.body.length === 1 && body.body[0].type === 'ReturnStatement') { errors.add( 'Use the shorthand arrow function form', node.body.loc.start ); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Require arrow functions to use an expression body { errors.add( 'Use the shorthand arrow function form', node.body.loc.start ); } |
| ✓ Negative was executed (else) | /**··· * Requir }); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Require abody.body[0].type === 'ReturnStatement') { |
| ✓ Was returned | /**··· * Require abody.type === 'BlockStatement' && body.body.length === 1 && |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Require abody.body.length === 1 && |
| ✓ Was returned | /**··· * Require abody.type === 'BlockStatement' && |
| Function (anonymous_1013) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_1014) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(operators) { var isTrue = operators === true; assert( Array.isArray(operators) || isTrue, this.getOptionName() + ' option requires array or true value' ); if (isTrue) { operators = allOperators; } this._operatorIndex = {}; for (var i = 0, l = operators.length; i < l; i++) { this._operatorIndex[operators[i]] = true; } }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disallows sticking binary operatoisTrue, |
| ✓ Was returned | /**··· * DisalArray.isArray(operators) || isTrue, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows sti{ operators = allOperators; } |
| ✓ Negative was executed (else) | /**··· * Di this._operatorIndex = {}; |
| Function (anonymous_1015) | |
|---|---|
| ✓ Was called | /**··· * Disallows stfunction() { return 'requireSpaceAfterBinaryOperators'; }, |
| Function (anonymous_1016) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { var operators = this._operatorIndex; // Comma if (operators[',']) { file.iterateTokensByTypeAndValue('Punctuator', ',', function(token) { errors.assert.whitespaceBetween({ token: token, nextToken: file.getNextToken(token), message: 'Operator , should not stick to following expression' }); }); } // For everything else file.iterateNodesByType( ['BinaryExpression', 'AssignmentExpression', 'VariableDeclarator', 'LogicalExpression'], function(node) { var operator; var expression; if (node.type === 'VariableDeclarator') { expression = node.init; operator = '='; } else { operator = node.operator; expression = node.right; } if (expression === null) { return; } var operatorToken = file.findPrevOperatorToken( file.getFirstNodeToken(expression), operator ); var nextToken = file.getNextToken(operatorToken); if (operators[operator]) { errors.assert.whitespaceBetween({ token: operatorToken, nextToken: nextToken, message: 'Operator ' + operator + ' should not stick to following expression' }); } } ); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows sticking bi{ file.iterateTokensByTypeAndValue('Punctuator', ',', function(token) { errors.assert.whitespaceBetween({ token: token, nextToken: file.getNextToken(token), message: 'Operator , should not stick to following expression' }); }); } |
| ✓ Negative was executed (else) | /**··· * Di // For everything else |
| Function (anonymous_1017) | |
|---|---|
| ✓ Was called | /**··· * Disallows sticking binary operators to the right. * * Tfunction(token) { errors.assert.whitespaceBetween({ token: token, nextToken: file.getNextToken(token), message: 'Operator , should not stick to following expression' }); }); |
| Function (anonymous_1018) | |
|---|---|
| ✓ Was called | /**··· * Disalfunction(node) { var operator; var expression; if (node.type === 'VariableDeclarator') { expression = node.init; operator = '='; } else { operator = node.operator; expression = node.right; } if (expression === null) { return; } var operatorToken = file.findPrevOperatorToken( file.getFirstNodeToken(expression), operator ); var nextToken = file.getNextToken(operatorToken); if (operators[operator]) { errors.assert.whitespaceBetween({ token: operatorToken, nextToken: nextToken, message: 'Operator ' + operator + ' should not stick to following expression' }); } } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows sticking binary operators to the right.{ expression = node.init; operator = '='; } else { |
| ✓ Negative was executed (else) | /**··· * Disallows sticki{ operator = node.operator; expression = node.right; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows sticking binary operator{ return; } |
| ✓ Negative was executed (else) | /**··· * Disallows var operatorToken = file.findPrevOperatorToken( |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows sticking binary operator{ errors.assert.whitespaceBetween({ token: operatorToken, nextToken: nextToken, message: 'Operator ' + operator + ' should not stick to following expression' }); } |
| ✓ Negative was executed (else) | /**··· * Disallows } |
| Function (anonymous_1019) | |
|---|---|
| ✓ Was called | /**··· * Requires sfunction() { }; |
| Function (anonymous_1020) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { if (typeof options !== 'object') { assert( options === true, this.getOptionName() + ' option requires true value or an object' ); var _options = {allExcept: []}; return this.configure(_options); } assert( Array.isArray(options.allExcept), ' property `allExcept` in ' + this.getOptionName() + ' should be an array of strings' ); this._exceptTrailingCommas = options.allExcept.indexOf('trailing') >= 0; }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space after comma * * T{ assert( options === true, this.getOptionName() + ' option requires true value or an object' ); var _options = {allExcept: []}; return this.configure(_options); } |
| ✓ Negative was executed (else) | /**··· * Re assert( |
| Function (anonymous_1021) | |
|---|---|
| ✓ Was called | /**··· * Requires spafunction() { return 'requireSpaceAfterComma'; }, |
| Function (anonymous_1022) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var exceptTrailingCommas = this._exceptTrailingCommas; file.iterateTokensByTypeAndValue('Punctuator', ',', function(token) { if (exceptTrailingCommas && [']', '}'].indexOf(file.getNextToken(token).value) >= 0) { return; } errors.assert.whitespaceBetween({ token: token, nextToken: file.getNextToken(token), message: 'Space required after comma' }); }); } |
| Function (anonymous_1023) | |
|---|---|
| ✓ Was called | /**··· * Requires space after comma * * Types: `Boolean`, orfunction(token) { if (exceptTrailingCommas && [']', '}'].indexOf(file.getNextToken(token).value) >= 0) { return; } errors.assert.whitespaceBetween({ token: token, nextToken: file.getNextToken(token), message: 'Space required after comma' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space after comma * * Types: `Boolean`, or `Object` * * Values: * - `Boolea{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir errors.assert.whitespaceBetween({ |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires space after comma * * [']', '}'].indexOf(file.getNextToken(token).value) >= 0) { |
| ✓ Was returned | /**··· * Requires exceptTrailingCommas && [']', '}'].indexOf(file.getNextToken(token).value) >= 0) { |
| Function (anonymous_1024) | |
|---|---|
| ✓ Was called | /**··· * Requires sfunction() {}; |
| Function (anonymous_1025) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(keywords) { assert( Array.isArray(keywords) || keywords === true, this.getOptionName() + ' option requires array or true value'); if (keywords === true) { keywords = defaultKeywords; } this._keywords = keywords; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires space after keyword. *keywords === true, |
| ✓ Was returned | /**··· * RequiArray.isArray(keywords) || keywords === true, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space after key{ keywords = defaultKeywords; } |
| ✓ Negative was executed (else) | /**··· * Re this._keywords = keywords; |
| Function (anonymous_1026) | |
|---|---|
| ✓ Was called | /**··· * Requires spafunction() { return 'requireSpaceAfterKeywords'; }, |
| Function (anonymous_1027) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { file.iterateTokensByTypeAndValue('Keyword', this._keywords, function(token) { var nextToken = file.getNextToken(token, {includeComments: true}); if (nextToken.type === 'Punctuator' && nextToken.value === ';') { return; } errors.assert.spacesBetween({ token: token, nextToken: nextToken, exactly: 1, message: 'One space required after "' + token.value + '" keyword' }); }); } |
| Function (anonymous_1028) | |
|---|---|
| ✓ Was called | /**··· * Requires space after keyword. * * Types: `Array` or `Booleafunction(token) { var nextToken = file.getNextToken(token, {includeComments: true}); if (nextToken.type === 'Punctuator' && nextToken.value === ';') { return; } errors.assert.spacesBetween({ token: token, nextToken: nextToken, exactly: 1, message: 'One space required after "' + token.value + '" keyword' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space after keyword. * * Types: `Array` or `Boolean` * *{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir errors.assert.spacesBetween({ |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires space after keyword. * * Types: `nextToken.value === ';') { |
| ✓ Was returned | /**··· * Requires nextToken.type === 'Punctuator' && nextToken.value === ';') { |
| Function (anonymous_1029) | |
|---|---|
| ✓ Was called | /**··· * Requires tfunction() {}; |
| Function (anonymous_1030) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { assert( options === true || options === 'allowSlash' || typeof options === 'object', this.getOptionName() + ' option requires a true value ' + 'or an object with String[] `allExcept` property' ); // verify first item in `allExcept` property in object (if it's an object) assert( typeof options !== 'object' || Array.isArray(options.allExcept) && typeof options.allExcept[0] === 'string', 'Property `allExcept` in ' + this.getOptionName() + ' should be an array of strings' ); // don't check triple slashed comments, microsoft js doc convention. see #593 // exceptions. see #592 // need to drop allowSlash support in 2.0. Fixes #697 this._allExcept = options === 'allowSlash' ? ['/'] : options.allExcept || []; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requitypeof options === 'object', |
| ✓ Was returned | /**··· * Requioptions === true || options === 'allowSlash' || |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requioptions === 'allowSlash' || |
| ✓ Was returned | /**··· * Requioptions === true || |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * RequiArray.isArray(options.allExcept) && typeof options.allExcept[0] === 'string', |
| ✓ Was returned | /**··· * Requitypeof options !== 'object' || |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requitypeof options.allExcept[0] === 'string', |
| ✗ Was not returned | /**··· * RequiArray.isArray(options.allExcept) && |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | /**··· * Requires that a line comment (`//`) be followe['/'] : |
| ✓ Negative was returned (: ...) | /**··· * Requioptions.allExcept || []; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires that a line comme[]; |
| ✓ Was returned | /**··· * Requioptions.allExcept || []; |
| Function (anonymous_1031) | |
|---|---|
| ✓ Was called | /**··· * Requires thafunction() { return 'requireSpaceAfterLineComment'; }, |
| Function (anonymous_1032) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var allExcept = this._allExcept; file.iterateTokensByType('Line', function(comment) { var value = comment.value; // cutout exceptions allExcept.forEach(function(el) { if (value.indexOf(el) === 0) { value = value.substr(el.length); } }); if (value.length === 0) { return; } if (value[0] !== ' ') { errors.add('Missing space after line comment', comment.loc.start); } }); } |
| Function (anonymous_1033) | |
|---|---|
| ✓ Was called | /**··· * Requires that a line comment (`//`function(comment) { var value = comment.value; // cutout exceptions allExcept.forEach(function(el) { if (value.indexOf(el) === 0) { value = value.substr(el.length); } }); if (value.length === 0) { return; } if (value[0] !== ' ') { errors.add('Missing space after line comment', comment.loc.start); } }); |
| Function (anonymous_1034) | |
|---|---|
| ✓ Was called | /**··· * Requires that a line cofunction(el) { if (value.indexOf(el) === 0) { value = value.substr(el.length); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires that a line comment (`//`) be{ value = value.substr(el.length); } |
| ✓ Negative was executed (else) | /**··· * Requires t }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires that a line comment { return; } |
| ✓ Negative was executed (else) | /**··· * Requir if (value[0] !== ' ') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires that a line commen{ errors.add('Missing space after line comment', comment.loc.start); } |
| ✓ Negative was executed (else) | /**··· * Requir }); |
| Function (anonymous_1035) | |
|---|---|
| ✓ Was called | /**··· * Requires sfunction() {}; |
| Function (anonymous_1036) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_1037) | |
|---|---|
| ✓ Was called | /**··· * Requires spafunction() { return 'requireSpaceAfterObjectKeys'; }, |
| Function (anonymous_1038) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { file.iterateNodesByType('ObjectExpression', function(node) { node.properties.forEach(function(property) { if (property.shorthand || property.kind !== 'init' || node.type === 'SpreadProperty') { return; } var token = file.getLastNodeToken(property.key); if (property.computed === true) { token = file.getNextToken(token); } errors.assert.whitespaceBetween({ token: token, nextToken: file.getNextToken(token), message: 'Missing space after key' }); }); }); } |
| Function (anonymous_1039) | |
|---|---|
| ✓ Was called | /**··· * Requires space after object keys. * * Type:function(node) { node.properties.forEach(function(property) { if (property.shorthand || property.kind !== 'init' || node.type === 'SpreadProperty') { return; } var token = file.getLastNodeToken(property.key); if (property.computed === true) { token = file.getNextToken(token); } errors.assert.whitespaceBetween({ token: token, nextToken: file.getNextToken(token), message: 'Missing space after key' }); }); }); |
| Function (anonymous_1040) | |
|---|---|
| ✓ Was called | /**··· * Requires space after object kfunction(property) { if (property.shorthand || property.kind !== 'init' || node.type === 'SpreadProperty') { return; } var token = file.getLastNodeToken(property.key); if (property.computed === true) { token = file.getNextToken(token); } errors.assert.whitespaceBetween({ token: token, nextToken: file.getNextToken(token), message: 'Missing space after key' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space after object keys. * * Type:{ return; } |
| ✓ Negative was executed (else) | /**··· * Requires s var token = file.getLastNodeToken(property.key); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires spacnode.type === 'SpreadProperty') { |
| ✓ Was returned | /**··· * Requires spacproperty.shorthand || property.kind !== 'init' || |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires space after object keys. property.kind !== 'init' || |
| ✓ Was returned | /**··· * Requires spacproperty.shorthand || property.kind !== 'init' || |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space after object keys. * * T{ token = file.getNextToken(token); } |
| ✓ Negative was executed (else) | /**··· * Requires s errors.assert.whitespaceBetween({ |
| Function (anonymous_1041) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_1042) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(operators) { var isTrue = operators === true; assert( Array.isArray(operators) || isTrue, this.getOptionName() + ' option requires array or true value' ); if (isTrue) { operators = defaultOperators; } this._operatorIndex = {}; for (var i = 0, l = operators.length; i < l; i++) { this._operatorIndex[operators[i]] = true; } }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disallows sticking unary operatorisTrue, |
| ✓ Was returned | /**··· * DisalArray.isArray(operators) || isTrue, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows sti{ operators = defaultOperators; } |
| ✓ Negative was executed (else) | /**··· * Di this._operatorIndex = {}; |
| Function (anonymous_1043) | |
|---|---|
| ✓ Was called | /**··· * Disallows stfunction() { return 'requireSpaceAfterPrefixUnaryOperators'; }, |
| Function (anonymous_1044) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { var operatorIndex = this._operatorIndex; file.iterateNodesByType(['UnaryExpression', 'UpdateExpression'], function(node) { // Check "node.prefix" for prefix type of (inc|dec)rement if (node.prefix && operatorIndex[node.operator]) { var argument = node.argument.type; var operatorToken = file.getFirstNodeToken(node); var nextToken = file.getNextToken(operatorToken); // Do not report consecutive operators (#405) if ( argument === 'UnaryExpression' || argument === 'UpdateExpression' && nextToken.value !== '(' ) { return; } errors.assert.whitespaceBetween({ token: operatorToken, nextToken: nextToken, message: 'Operator ' + node.operator + ' should not stick to operand' }); } }); } |
| Function (anonymous_1045) | |
|---|---|
| ✓ Was called | /**··· * Disallows sticking unary operators to the right. * * Types: `Arrfunction(node) { // Check "node.prefix" for prefix type of (inc|dec)rement if (node.prefix && operatorIndex[node.operator]) { var argument = node.argument.type; var operatorToken = file.getFirstNodeToken(node); var nextToken = file.getNextToken(operatorToken); // Do not report consecutive operators (#405) if ( argument === 'UnaryExpression' || argument === 'UpdateExpression' && nextToken.value !== '(' ) { return; } errors.assert.whitespaceBetween({ token: operatorToken, nextToken: nextToken, message: 'Operator ' + node.operator + ' should not stick to operand' }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows sticking unary operators to the right. * *{ var argument = node.argument.type; var operatorToken = file.getFirstNodeToken(node); var nextToken = file.getNextToken(operatorToken); // Do not report consecutive operators (#405) if ( argument === 'UnaryExpression' || argument === 'UpdateExpression' && nextToken.value !== '(' ) { return; } errors.assert.whitespaceBetween({ token: operatorToken, nextToken: nextToken, message: 'Operator ' + node.operator + ' should not stick to operand' }); } |
| ✓ Negative was executed (else) | /**··· * Disall }); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows sticking unaryoperatorIndex[node.operator]) { |
| ✗ Was not returned | /**··· * Disallowsnode.prefix && operatorIndex[node.operator]) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows s{ return; } |
| ✓ Negative was executed (else) | /**··· * Disallows errors.assert.whitespaceBetween({ |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disallows sticking unary operators to the rightargument === 'UpdateExpression' && nextToken.value !== '(' |
| ✓ Was returned | /**··· * Disallows stiargument === 'UnaryExpression' || argument === 'UpdateExpression' && |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows stinextToken.value !== '(' |
| ✓ Was returned | /**··· * Disallows sticking unary operators to the rightargument === 'UpdateExpression' && |
| Function (anonymous_1047) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_1048) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(operators) { var isTrue = operators === true; assert( Array.isArray(operators) || isTrue, this.getOptionName() + ' option requires array or true value' ); if (isTrue) { operators = allOperators; } this._operatorIndex = {}; for (var i = 0, l = operators.length; i < l; i++) { this._operatorIndex[operators[i]] = true; } }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disallows sticking binary operatoisTrue, |
| ✓ Was returned | /**··· * DisalArray.isArray(operators) || isTrue, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows sti{ operators = allOperators; } |
| ✓ Negative was executed (else) | /**··· * Di this._operatorIndex = {}; |
| Function (anonymous_1049) | |
|---|---|
| ✓ Was called | /**··· * Disallows stfunction() { return 'requireSpaceBeforeBinaryOperators'; }, |
| Function (anonymous_1050) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { var operators = this._operatorIndex; // Comma if (operators[',']) { file.iterateTokensByTypeAndValue('Punctuator', ',', function(token) { errors.assert.whitespaceBetween({ token: file.getPrevToken(token), nextToken: token, message: 'Operator , should not stick to preceding expression' }); }); } // For everything else file.iterateNodesByType( ['BinaryExpression', 'AssignmentExpression', 'VariableDeclarator', 'LogicalExpression'], function(node) { var operator; var expression; if (node.type === 'VariableDeclarator') { expression = node.init; operator = '='; } else { operator = node.operator; expression = node.right; } if (expression === null) { return; } var operatorToken = file.findPrevOperatorToken( file.getFirstNodeToken(expression), operator ); var prevToken = file.getPrevToken(operatorToken); if (operators[operator]) { errors.assert.whitespaceBetween({ token: prevToken, nextToken: operatorToken, message: 'Operator ' + operator + ' should not stick to preceding expression' }); } } ); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows sticking bi{ file.iterateTokensByTypeAndValue('Punctuator', ',', function(token) { errors.assert.whitespaceBetween({ token: file.getPrevToken(token), nextToken: token, message: 'Operator , should not stick to preceding expression' }); }); } |
| ✓ Negative was executed (else) | /**··· * Di // For everything else |
| Function (anonymous_1051) | |
|---|---|
| ✓ Was called | /**··· * Disallows sticking binary operators to the left. * * Tyfunction(token) { errors.assert.whitespaceBetween({ token: file.getPrevToken(token), nextToken: token, message: 'Operator , should not stick to preceding expression' }); }); |
| Function (anonymous_1052) | |
|---|---|
| ✓ Was called | /**··· * Disalfunction(node) { var operator; var expression; if (node.type === 'VariableDeclarator') { expression = node.init; operator = '='; } else { operator = node.operator; expression = node.right; } if (expression === null) { return; } var operatorToken = file.findPrevOperatorToken( file.getFirstNodeToken(expression), operator ); var prevToken = file.getPrevToken(operatorToken); if (operators[operator]) { errors.assert.whitespaceBetween({ token: prevToken, nextToken: operatorToken, message: 'Operator ' + operator + ' should not stick to preceding expression' }); } } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows sticking binary operators to the left. { expression = node.init; operator = '='; } else { |
| ✓ Negative was executed (else) | /**··· * Disallows sticki{ operator = node.operator; expression = node.right; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows sticking binary operator{ return; } |
| ✓ Negative was executed (else) | /**··· * Disallows var operatorToken = file.findPrevOperatorToken( |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows sticking binary operator{ errors.assert.whitespaceBetween({ token: prevToken, nextToken: operatorToken, message: 'Operator ' + operator + ' should not stick to preceding expression' }); } |
| ✓ Negative was executed (else) | /**··· * Disallows } |
| Function (anonymous_1053) | |
|---|---|
| ✓ Was called | /**··· * Requires sfunction() {}; |
| Function (anonymous_1054) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(requireSpaceBeforeBlockStatements) { assert( typeof requireSpaceBeforeBlockStatements === 'boolean' || typeof requireSpaceBeforeBlockStatements === 'number', this.getOptionName() + ' option requires number or bolean' ); assert( requireSpaceBeforeBlockStatements >= 1, this.getOptionName() + ' option requires true value or a number greater than equal to 1 or should be removed' ); this._count = +requireSpaceBeforeBlockStatements; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requitypeof requireSpaceBeforeBlockStatements === 'number', |
| ✓ Was returned | /**··· * Requitypeof requireSpaceBeforeBlockStatements === 'boolean' || |
| Function (anonymous_1055) | |
|---|---|
| ✓ Was called | /**··· * Requires spafunction() { return 'requireSpaceBeforeBlockStatements'; }, |
| Function (anonymous_1056) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var count = this._count; file.iterateNodesByType('BlockStatement', function(node) { var first = file.getFirstNodeToken(node); errors.assert.spacesBetween({ token: file.getPrevToken(first), nextToken: first, atLeast: count, disallowNewLine: true, message: 'One (or more) spaces required before opening brace for block expressions' }); }); } |
| Function (anonymous_1057) | |
|---|---|
| ✓ Was called | /**··· * Requires space(s) before block statements (function(node) { var first = file.getFirstNodeToken(node); errors.assert.spacesBetween({ token: file.getPrevToken(first), nextToken: first, atLeast: count, disallowNewLine: true, message: 'One (or more) spaces required before opening brace for block expressions' }); }); |
| Function (anonymous_1058) | |
|---|---|
| ✓ Was called | /**··· * Requires sfunction() { }; |
| Function (anonymous_1059) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(option) { assert( option === true, this.getOptionName() + ' option requires true value' ); }, |
| Function (anonymous_1060) | |
|---|---|
| ✓ Was called | /**··· * Requires spafunction() { return 'requireSpaceBeforeComma'; }, |
| Function (anonymous_1061) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { file.iterateTokensByTypeAndValue('Punctuator', ',', function(token) { var prevToken = file.getPrevToken(token); errors.assert.whitespaceBetween({ token: prevToken, nextToken: token, message: 'Space required before comma' }); }); } |
| Function (anonymous_1062) | |
|---|---|
| ✓ Was called | /**··· * Requires space before comma * * Types: `Boolean` *function(token) { var prevToken = file.getPrevToken(token); errors.assert.whitespaceBetween({ token: prevToken, nextToken: token, message: 'Space required before comma' }); }); |
| Function (anonymous_1063) | |
|---|---|
| ✓ Was called | /**··· * Requires sfunction() {}; |
| Function (anonymous_1064) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(keywords) { assert( Array.isArray(keywords) || keywords === true, this.getOptionName() + ' option requires array or true value'); if (keywords === true) { keywords = defaultKeywords; } this._keywords = keywords; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires space before keyword. keywords === true, |
| ✓ Was returned | /**··· * RequiArray.isArray(keywords) || keywords === true, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before ke{ keywords = defaultKeywords; } |
| ✓ Negative was executed (else) | /**··· * Re this._keywords = keywords; |
| Function (anonymous_1065) | |
|---|---|
| ✓ Was called | /**··· * Requires spafunction() { return 'requireSpaceBeforeKeywords'; }, |
| Function (anonymous_1066) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { file.iterateTokensByTypeAndValue('Keyword', this._keywords, function(token) { var prevToken = file.getPrevToken(token, {includeComments: true}); if (!prevToken || prevToken.isComment) { return; } if (prevToken.type !== 'Punctuator' || prevToken.value !== ';') { errors.assert.whitespaceBetween({ token: prevToken, nextToken: token, message: 'Missing space before "' + token.value + '" keyword' }); } }); } |
| Function (anonymous_1067) | |
|---|---|
| ✓ Was called | /**··· * Requires space before keyword. * * Types: `Array` or `Boolefunction(token) { var prevToken = file.getPrevToken(token, {includeComments: true}); if (!prevToken || prevToken.isComment) { return; } if (prevToken.type !== 'Punctuator' || prevToken.value !== ';') { errors.assert.whitespaceBetween({ token: prevToken, nextToken: token, message: 'Missing space before "' + token.value + '" keyword' }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before keyword. * * Types: { return; } |
| ✓ Negative was executed (else) | /**··· * Requir if (prevToken.type !== 'Punctuator' || prevToken.value !== ';') { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires space before kprevToken.isComment) { |
| ✓ Was returned | /**··· * Requires !prevToken || prevToken.isComment) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before keyword. * * Types: `Array` or `Boolean` * { errors.assert.whitespaceBetween({ token: prevToken, nextToken: token, message: 'Missing space before "' + token.value + '" keyword' }); } |
| ✓ Negative was executed (else) | /**··· * Requir }); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires space before keyword. * * Types: prevToken.value !== ';') { |
| ✗ Was not returned | /**··· * Requires prevToken.type !== 'Punctuator' || prevToken.value !== ';') { |
| Function (anonymous_1068) | |
|---|---|
| ✓ Was called | /**··· * Requires sfunction() {}; |
| Function (anonymous_1069) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_1070) | |
|---|---|
| ✓ Was called | /**··· * Requires spafunction() { return 'requireSpaceBeforeObjectValues'; }, |
| Function (anonymous_1071) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { file.iterateNodesByType('ObjectExpression', function(node) { node.properties.forEach(function(property) { if (property.shorthand || property.method || property.kind !== 'init' || node.type === 'SpreadProperty') { return; } var keyToken = file.getFirstNodeToken(property.key); var colon = file.findNextToken(keyToken, 'Punctuator', ':'); errors.assert.whitespaceBetween({ token: colon, nextToken: file.getNextToken(colon), message: 'Missing space after key colon' }); }); }); } |
| Function (anonymous_1072) | |
|---|---|
| ✓ Was called | /**··· * Requires space after object keys. * * Type:function(node) { node.properties.forEach(function(property) { if (property.shorthand || property.method || property.kind !== 'init' || node.type === 'SpreadProperty') { return; } var keyToken = file.getFirstNodeToken(property.key); var colon = file.findNextToken(keyToken, 'Punctuator', ':'); errors.assert.whitespaceBetween({ token: colon, nextToken: file.getNextToken(colon), message: 'Missing space after key colon' }); }); }); |
| Function (anonymous_1073) | |
|---|---|
| ✓ Was called | /**··· * Requires space after object kfunction(property) { if (property.shorthand || property.method || property.kind !== 'init' || node.type === 'SpreadProperty') { return; } var keyToken = file.getFirstNodeToken(property.key); var colon = file.findNextToken(keyToken, 'Punctuator', ':'); errors.assert.whitespaceBetween({ token: colon, nextToken: file.getNextToken(colon), message: 'Missing space after key colon' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space after object keys. * * Type:{ return; } |
| ✓ Negative was executed (else) | /**··· * Requires s var keyToken = file.getFirstNodeToken(property.key); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires spacnode.type === 'SpreadProperty') { |
| ✓ Was returned | /**··· * Requires spacproperty.shorthand || property.method || property.kind !== 'init' || |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires space after object keys. * * Type: `Booleanproperty.kind !== 'init' || |
| ✓ Was returned | /**··· * Requires spacproperty.shorthand || property.method || property.kind !== 'init' || |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires space after object keys. property.method || property.kind !== 'init' || |
| ✓ Was returned | /**··· * Requires spacproperty.shorthand || property.method || property.kind !== 'init' || |
| Function (anonymous_1074) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_1075) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(operators) { var isTrue = operators === true; assert( Array.isArray(operators) || isTrue, this.getOptionName() + ' option requires array or true value' ); if (isTrue) { operators = defaultOperators; } this._operatorIndex = {}; for (var i = 0, l = operators.length; i < l; i++) { this._operatorIndex[operators[i]] = true; } }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Disallows sticking unary operatorisTrue, |
| ✓ Was returned | /**··· * DisalArray.isArray(operators) || isTrue, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows sti{ operators = defaultOperators; } |
| ✓ Negative was executed (else) | /**··· * Di this._operatorIndex = {}; |
| Function (anonymous_1076) | |
|---|---|
| ✓ Was called | /**··· * Disallows stfunction() { return 'requireSpaceBeforePostfixUnaryOperators'; }, |
| Function (anonymous_1077) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { var operatorIndex = this._operatorIndex; // 'UpdateExpression' involve only ++ and -- operators file.iterateNodesByType('UpdateExpression', function(node) { // "!node.prefix" means postfix type of (inc|dec)rement if (!node.prefix && operatorIndex[node.operator]) { var operatorToken = file.getLastNodeToken(node); errors.assert.whitespaceBetween({ token: file.getPrevToken(operatorToken), nextToken: operatorToken, message: 'Operator ' + node.operator + ' should not stick to operand' }); } }); } |
| Function (anonymous_1078) | |
|---|---|
| ✓ Was called | /**··· * Disallows sticking unary operators to the leffunction(node) { // "!node.prefix" means postfix type of (inc|dec)rement if (!node.prefix && operatorIndex[node.operator]) { var operatorToken = file.getLastNodeToken(node); errors.assert.whitespaceBetween({ token: file.getPrevToken(operatorToken), nextToken: operatorToken, message: 'Operator ' + node.operator + ' should not stick to operand' }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows sticking unary operators to the left. * * T{ var operatorToken = file.getLastNodeToken(node); errors.assert.whitespaceBetween({ token: file.getPrevToken(operatorToken), nextToken: operatorToken, message: 'Operator ' + node.operator + ' should not stick to operand' }); } |
| ✗ Negative was not executed (else) | /**··· * Disall }); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows sticking unary operatorIndex[node.operator]) { |
| ✗ Was not returned | /**··· * Disallows!node.prefix && operatorIndex[node.operator]) { |
| Function (anonymous_1079) | |
|---|---|
| ✓ Was called | /**··· * Ensure thefunction() {}; |
| Function (anonymous_1080) | |
|---|---|
| ✓ Was called | /**··· * Ensure tfunction(options) { assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_1081) | |
|---|---|
| ✓ Was called | /**··· * Ensure therefunction() { return 'requireSpaceBetweenArguments'; }, |
| Function (anonymous_1082) | |
|---|---|
| ✓ Was called | /**··· * Ensufunction(file, errors) { file.iterateNodesByType(['CallExpression'], function(node) { node.arguments.forEach(function(param) { var punctuatorToken = file.getPrevToken(file.getFirstNodeToken(param)); if (punctuatorToken.value === ',') { errors.assert.whitespaceBetween({ token: punctuatorToken, nextToken: file.getNextToken(punctuatorToken) }); } }); }); } |
| Function (anonymous_1083) | |
|---|---|
| ✓ Was called | /**··· * Ensure there are spaces after argument separafunction(node) { node.arguments.forEach(function(param) { var punctuatorToken = file.getPrevToken(file.getFirstNodeToken(param)); if (punctuatorToken.value === ',') { errors.assert.whitespaceBetween({ token: punctuatorToken, nextToken: file.getNextToken(punctuatorToken) }); } }); }); |
| Function (anonymous_1084) | |
|---|---|
| ✓ Was called | /**··· * Ensure there are spaces aftefunction(param) { var punctuatorToken = file.getPrevToken(file.getFirstNodeToken(param)); if (punctuatorToken.value === ',') { errors.assert.whitespaceBetween({ token: punctuatorToken, nextToken: file.getNextToken(punctuatorToken) }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Ensure there are spaces after argument separ{ errors.assert.whitespaceBetween({ token: punctuatorToken, nextToken: file.getNextToken(punctuatorToken) }); } |
| ✓ Negative was executed (else) | /**··· * Ensure the }); |
| Function (anonymous_1085) | |
|---|---|
| ✓ Was called | /**··· * Requires sfunction() {}; |
| Function (anonymous_1086) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { this._exceptions = { 'shorthand': false }; assert( typeof options === 'object', this.getOptionName() + ' option must be the object' ); if ('beforeOpeningRoundBrace' in options) { assert( options.beforeOpeningRoundBrace === true, this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } if ('beforeOpeningCurlyBrace' in options) { assert( options.beforeOpeningCurlyBrace === true, this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } if ('allExcept' in options) { if (typeof options.allExcept === 'object') { assert( Array.isArray(options.allExcept), this.getOptionName() + ' option requires "allExcept" to be ' + 'an array' ); assert( options.allExcept.length > 0, this.getOptionName() + ' option requires "allExcept" to have ' + 'at least one item or be set to `true`' ); options.allExcept.forEach(function(except) { if (except === 'shorthand') { this._exceptions.shorthand = true; } else { assert(false, this.getOptionName() + ' option requires ' + '"allExcept" to be an array containing "shorthand"'); } }, this); } else { assert( options.allExcept === true, this.getOptionName() + ' option requires a true value or array' ); this._exceptions.shorthand = true; } } assert( options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, this.getOptionName() + ' must have beforeOpeningCurlyBrace ' + ' or beforeOpeningRoundBrace property' ); this._beforeOpeningRoundBrace = Boolean(options.beforeOpeningRoundBrace); this._beforeOpeningCurlyBrace = Boolean(options.beforeOpeningCurlyBrace); }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before `()` or `{}` in anony{ assert( options.beforeOpeningRoundBrace === true, this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | /**··· * Re if ('beforeOpeningCurlyBrace' in options) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before `()` or `{}` in anony{ assert( options.beforeOpeningCurlyBrace === true, this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | /**··· * Re if ('allExcept' in options) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before `()` or{ if (typeof options.allExcept === 'object') { assert( Array.isArray(options.allExcept), this.getOptionName() + ' option requires "allExcept" to be ' + 'an array' ); assert( options.allExcept.length > 0, this.getOptionName() + ' option requires "allExcept" to have ' + 'at least one item or be set to `true`' ); options.allExcept.forEach(function(except) { if (except === 'shorthand') { this._exceptions.shorthand = true; } else { assert(false, this.getOptionName() + ' option requires ' + '"allExcept" to be an array containing "shorthand"'); } }, this); } else { assert( options.allExcept === true, this.getOptionName() + ' option requires a true value or array' ); this._exceptions.shorthand = true; } } |
| ✓ Negative was executed (else) | /**··· * Re assert( |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before `()` or `{}` in anonymous { assert( Array.isArray(options.allExcept), this.getOptionName() + ' option requires "allExcept" to be ' + 'an array' ); assert( options.allExcept.length > 0, this.getOptionName() + ' option requires "allExcept" to have ' + 'at least one item or be set to `true`' ); options.allExcept.forEach(function(except) { if (except === 'shorthand') { this._exceptions.shorthand = true; } else { assert(false, this.getOptionName() + ' option requires ' + '"allExcept" to be an array containing "shorthand"'); } }, this); } else { |
| ✓ Negative was executed (else) | /**··· * Requires spa{ assert( options.allExcept === true, this.getOptionName() + ' option requires a true value or array' ); this._exceptions.shorthand = true; } |
| Function (anonymous_1087) | |
|---|---|
| ✓ Was called | /**··· * Requires space before `()` or `{}` function(except) { if (except === 'shorthand') { this._exceptions.shorthand = true; } else { assert(false, this.getOptionName() + ' option requires ' + '"allExcept" to be an array containing "shorthand"'); } }, this); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before `()` or `{}` in ano{ this._exceptions.shorthand = true; } else { |
| ✓ Negative was executed (else) | /**··· * Requires space befor{ assert(false, this.getOptionName() + ' option requires ' + '"allExcept" to be an array containing "shorthand"'); } |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires space before `()` or `{}` in anoptions.beforeOpeningRoundBrace, |
| ✓ Was returned | /**··· * Requioptions.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, |
| Function (anonymous_1088) | |
|---|---|
| ✓ Was called | /**··· * Requires spafunction() { return 'requireSpacesInAnonymousFunctionExpression'; }, |
| Function (anonymous_1089) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var beforeOpeningRoundBrace = this._beforeOpeningRoundBrace; var beforeOpeningCurlyBrace = this._beforeOpeningCurlyBrace; var exceptions = this._exceptions; file.iterateNodesByType(['FunctionExpression'], function(node) { var functionNode = node; var parent = node.parentNode; // Ignore syntactic sugar for getters and setters. if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { return; } // shorthand or constructor methods if (parent.method || parent.type === 'MethodDefinition') { functionNode = parent.key; if (exceptions.shorthand) { return; } } // anonymous function expressions only if (node.id) { return; } if (beforeOpeningRoundBrace) { var functionToken = file.getFirstNodeToken(functionNode); if (node.async && functionToken.value === 'async') { functionToken = file.getNextToken(functionToken); } // if generator, set token to be * instead if (node.generator && functionToken.value === 'function') { functionToken = file.getNextToken(functionToken); } errors.assert.whitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Missing space before opening round brace' }); } if (beforeOpeningCurlyBrace) { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.whitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Missing space before opening curly brace' }); } }); } |
| Function (anonymous_1090) | |
|---|---|
| ✓ Was called | /**··· * Requires space before `()` or `{}` in anonymous ffunction(node) { var functionNode = node; var parent = node.parentNode; // Ignore syntactic sugar for getters and setters. if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { return; } // shorthand or constructor methods if (parent.method || parent.type === 'MethodDefinition') { functionNode = parent.key; if (exceptions.shorthand) { return; } } // anonymous function expressions only if (node.id) { return; } if (beforeOpeningRoundBrace) { var functionToken = file.getFirstNodeToken(functionNode); if (node.async && functionToken.value === 'async') { functionToken = file.getNextToken(functionToken); } // if generator, set token to be * instead if (node.generator && functionToken.value === 'function') { functionToken = file.getNextToken(functionToken); } errors.assert.whitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Missing space before opening round brace' }); } if (beforeOpeningCurlyBrace) { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.whitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Missing space before opening curly brace' }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before `()` or `{}` in anonymous function expressions. * * Type: `Object{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir // shorthand or constructor methods |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires space before `()` or `{}` in anparent.kind === 'get' || parent.kind === 'set')) { |
| ✓ Was returned | /**··· * Requires parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires space before `()` or `{}` in anonymous function expressiparent.kind === 'set')) { |
| ✓ Was returned | /**··· * Requires space before `()` or `{}` in anparent.kind === 'get' || parent.kind === 'set')) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before `()` or `{}` in anonymous function expre{ functionNode = parent.key; if (exceptions.shorthand) { return; } } |
| ✓ Negative was executed (else) | /**··· * Requir // anonymous function expressions only |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires space before `()`parent.type === 'MethodDefinition') { |
| ✓ Was returned | /**··· * Requires parent.method || parent.type === 'MethodDefinition') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before `()` or `{}` { return; } |
| ✓ Negative was executed (else) | /**··· * Requires s } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space bef{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir if (beforeOpeningRoundBrace) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before `()` or `{}`{ var functionToken = file.getFirstNodeToken(functionNode); if (node.async && functionToken.value === 'async') { functionToken = file.getNextToken(functionToken); } // if generator, set token to be * instead if (node.generator && functionToken.value === 'function') { functionToken = file.getNextToken(functionToken); } errors.assert.whitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Missing space before opening round brace' }); } |
| ✓ Negative was executed (else) | /**··· * Requir if (beforeOpeningCurlyBrace) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before `()` or `{}` in anonymous function exp{ functionToken = file.getNextToken(functionToken); } |
| ✓ Negative was executed (else) | /**··· * Requires s // if generator, set token to be * instead |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires space before `()` functionToken.value === 'async') { |
| ✓ Was returned | /**··· * Requires spacnode.async && functionToken.value === 'async') { |
| Branch IfStatement | |
|---|---|
| ✗ Positive was not executed (if) | /**··· * Requires space before `()` or `{}` in anonymous function expression{ functionToken = file.getNextToken(functionToken); } |
| ✓ Negative was executed (else) | /**··· * Requires s errors.assert.whitespaceBetween({ |
| Branch LogicalExpression | |
| ✗ Was not returned | /**··· * Requires space before `()` or `functionToken.value === 'function') { |
| ✓ Was returned | /**··· * Requires spacnode.generator && functionToken.value === 'function') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before `()` or `{}`{ var bodyToken = file.getFirstNodeToken(node.body); errors.assert.whitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Missing space before opening curly brace' }); } |
| ✓ Negative was executed (else) | /**··· * Requir }); |
| Function (anonymous_1091) | |
|---|---|
| ✓ Was called | /**··· * Requires sfunction() {}; |
| Function (anonymous_1092) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_1093) | |
|---|---|
| ✓ Was called | /**··· * Requires spafunction() { return 'requireSpacesInCallExpression'; }, |
| Function (anonymous_1094) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { file.iterateNodesByType('CallExpression', function(node) { var lastCalleeToken = file.getLastNodeToken(node.callee); var roundBraceToken = file.findNextToken(lastCalleeToken, 'Punctuator', '('); errors.assert.whitespaceBetween({ token: file.getPrevToken(roundBraceToken), nextToken: roundBraceToken, message: 'Missing space before opening round brace' }); }); } |
| Function (anonymous_1095) | |
|---|---|
| ✓ Was called | /**··· * Requires space before `()` in call expressifunction(node) { var lastCalleeToken = file.getLastNodeToken(node.callee); var roundBraceToken = file.findNextToken(lastCalleeToken, 'Punctuator', '('); errors.assert.whitespaceBetween({ token: file.getPrevToken(roundBraceToken), nextToken: roundBraceToken, message: 'Missing space before opening round brace' }); }); |
| Function (anonymous_1096) | |
|---|---|
| ✓ Was called | /**··· * Requires sfunction() {}; |
| Function (anonymous_1097) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { var validProperties = [ 'afterTest', 'beforeConsequent', 'afterConsequent', 'beforeAlternate' ]; var optionName = this.getOptionName(); if (options === true) { options = { 'afterTest': true, 'beforeConsequent': true, 'afterConsequent': true, 'beforeAlternate': true }; } assert( typeof options === 'object', optionName + ' option requires a true value or an object' ); var isProperlyConfigured = validProperties.some(function(key) { var isPresent = key in options; if (isPresent) { assert( options[key] === true, optionName + '.' + key + ' property requires true value or should be removed' ); } return isPresent; }); assert( isProperlyConfigured, optionName + ' must have at least 1 of the following properties: ' + validProperties.join(', ') ); validProperties.forEach(function(property) { this['_' + property] = Boolean(options[property]); }.bind(this)); }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before a{ options = { 'afterTest': true, 'beforeConsequent': true, 'afterConsequent': true, 'beforeAlternate': true }; } |
| ✓ Negative was executed (else) | /**··· * Re assert( |
| Function (anonymous_1098) | |
|---|---|
| ✓ Was called | /**··· * Requires space before and/or after `?` or `:` in function(key) { var isPresent = key in options; if (isPresent) { assert( options[key] === true, optionName + '.' + key + ' property requires true value or should be removed' ); } return isPresent; }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space befor{ assert( options[key] === true, optionName + '.' + key + ' property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | /**··· * Requir return isPresent; |
| Function (anonymous_1099) | |
|---|---|
| ✓ Was called | /**··· * Requires space before andfunction(property) { this['_' + property] = Boolean(options[property]); }.bind(this)); |
| Function (anonymous_1100) | |
|---|---|
| ✓ Was called | /**··· * Requires spafunction() { return 'requireSpacesInConditionalExpression'; }, |
| Function (anonymous_1101) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { file.iterateNodesByType(['ConditionalExpression'], function(node) { var consequent = node.consequent; var alternate = node.alternate; var consequentToken = file.getFirstNodeToken(consequent); var alternateToken = file.getFirstNodeToken(alternate); var questionMarkToken = file.findPrevOperatorToken(consequentToken, '?'); var colonToken = file.findPrevOperatorToken(alternateToken, ':'); var token; if (this._afterTest) { token = file.getPrevToken(questionMarkToken); errors.assert.whitespaceBetween({ token: token, nextToken: questionMarkToken, message: 'Missing space after test' }); } if (this._beforeConsequent) { token = file.getNextToken(questionMarkToken); errors.assert.whitespaceBetween({ token: questionMarkToken, nextToken: token, message: 'Missing space before consequent' }); } if (this._afterConsequent) { token = file.getPrevToken(colonToken); errors.assert.whitespaceBetween({ token: token, nextToken: colonToken, message: 'Missing space after consequent' }); } if (this._beforeAlternate) { token = file.getNextToken(colonToken); errors.assert.whitespaceBetween({ token: colonToken, nextToken: token, message: 'Missing space before alternate' }); } }.bind(this)); } |
| Function (anonymous_1102) | |
|---|---|
| ✓ Was called | /**··· * Requires space before and/or after `?` or `:` in confunction(node) { var consequent = node.consequent; var alternate = node.alternate; var consequentToken = file.getFirstNodeToken(consequent); var alternateToken = file.getFirstNodeToken(alternate); var questionMarkToken = file.findPrevOperatorToken(consequentToken, '?'); var colonToken = file.findPrevOperatorToken(alternateToken, ':'); var token; if (this._afterTest) { token = file.getPrevToken(questionMarkToken); errors.assert.whitespaceBetween({ token: token, nextToken: questionMarkToken, message: 'Missing space after test' }); } if (this._beforeConsequent) { token = file.getNextToken(questionMarkToken); errors.assert.whitespaceBetween({ token: questionMarkToken, nextToken: token, message: 'Missing space before consequent' }); } if (this._afterConsequent) { token = file.getPrevToken(colonToken); errors.assert.whitespaceBetween({ token: token, nextToken: colonToken, message: 'Missing space after consequent' }); } if (this._beforeAlternate) { token = file.getNextToken(colonToken); errors.assert.whitespaceBetween({ token: colonToken, nextToken: token, message: 'Missing space before alternate' }); } }.bind(this)); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before and/{ token = file.getPrevToken(questionMarkToken); errors.assert.whitespaceBetween({ token: token, nextToken: questionMarkToken, message: 'Missing space after test' }); } |
| ✓ Negative was executed (else) | /**··· * Requir if (this._beforeConsequent) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before and/or afte{ token = file.getNextToken(questionMarkToken); errors.assert.whitespaceBetween({ token: questionMarkToken, nextToken: token, message: 'Missing space before consequent' }); } |
| ✓ Negative was executed (else) | /**··· * Requir if (this._afterConsequent) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before and/or aft{ token = file.getPrevToken(colonToken); errors.assert.whitespaceBetween({ token: token, nextToken: colonToken, message: 'Missing space after consequent' }); } |
| ✓ Negative was executed (else) | /**··· * Requir if (this._beforeAlternate) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before and/or aft{ token = file.getNextToken(colonToken); errors.assert.whitespaceBetween({ token: colonToken, nextToken: token, message: 'Missing space before alternate' }); } |
| ✓ Negative was executed (else) | /**··· * Requir }.bind(this)); |
| Function (anonymous_1103) | |
|---|---|
| ✓ Was called | /**··· * Requires sfunction() {}; |
| Function (anonymous_1104) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_1105) | |
|---|---|
| ✓ Was called | /**··· * Requires spafunction() { return 'requireSpacesInForStatement'; }, |
| Function (anonymous_1106) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { file.iterateNodesByType('ForStatement', function(node) { if (node.test) { var testToken = file.getFirstNodeToken(node.test); var prevToken = file.getPrevToken(testToken); if (prevToken.value === '(' && TokenCategorizer.categorizeOpenParen(prevToken, file) === 'ParenthesizedExpression') { testToken = prevToken; prevToken = file.getPrevToken(prevToken); } errors.assert.spacesBetween({ token: prevToken, nextToken: testToken, exactly: 1, message: 'One space required after semicolon' }); } if (node.update) { var updateToken = file.getFirstNodeToken(node.update); errors.assert.spacesBetween({ token: file.getPrevToken(updateToken), nextToken: updateToken, exactly: 1, message: 'One space required after semicolon' }); } }); } |
| Function (anonymous_1107) | |
|---|---|
| ✓ Was called | /**··· * Requires spaces inbetween for statement. function(node) { if (node.test) { var testToken = file.getFirstNodeToken(node.test); var prevToken = file.getPrevToken(testToken); if (prevToken.value === '(' && TokenCategorizer.categorizeOpenParen(prevToken, file) === 'ParenthesizedExpression') { testToken = prevToken; prevToken = file.getPrevToken(prevToken); } errors.assert.spacesBetween({ token: prevToken, nextToken: testToken, exactly: 1, message: 'One space required after semicolon' }); } if (node.update) { var updateToken = file.getFirstNodeToken(node.update); errors.assert.spacesBetween({ token: file.getPrevToken(updateToken), nextToken: updateToken, exactly: 1, message: 'One space required after semicolon' }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires spaces inbe{ var testToken = file.getFirstNodeToken(node.test); var prevToken = file.getPrevToken(testToken); if (prevToken.value === '(' && TokenCategorizer.categorizeOpenParen(prevToken, file) === 'ParenthesizedExpression') { testToken = prevToken; prevToken = file.getPrevToken(prevToken); } errors.assert.spacesBetween({ token: prevToken, nextToken: testToken, exactly: 1, message: 'One space required after semicolon' }); } |
| ✓ Negative was executed (else) | /**··· * Requir if (node.update) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires spaces inbetween for statement. * * Type: `Boolean` * * Value: `true` to requires spa{ testToken = prevToken; prevToken = file.getPrevToken(prevToken); } |
| ✓ Negative was executed (else) | /**··· * Requires s errors.assert.spacesBetween({ |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires spacTokenCategorizer.categorizeOpenParen(prevToken, file) === 'ParenthesizedExpression') { |
| ✓ Was returned | /**··· * Requires spacprevToken.value === '(' && |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires spaces inbetw{ var updateToken = file.getFirstNodeToken(node.update); errors.assert.spacesBetween({ token: file.getPrevToken(updateToken), nextToken: updateToken, exactly: 1, message: 'One space required after semicolon' }); } |
| ✓ Negative was executed (else) | /**··· * Requir }); |
| Function (anonymous_1108) | |
|---|---|
| ✓ Was called | /**··· * Requires sfunction() {}; |
| Function (anonymous_1109) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { assert( typeof options === 'object', this.getOptionName() + ' option must be the object' ); if ('beforeOpeningRoundBrace' in options) { assert( options.beforeOpeningRoundBrace === true, this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } if ('beforeOpeningCurlyBrace' in options) { assert( options.beforeOpeningCurlyBrace === true, this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } assert( options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, this.getOptionName() + ' must have beforeOpeningCurlyBrace or beforeOpeningRoundBrace property' ); this._beforeOpeningRoundBrace = Boolean(options.beforeOpeningRoundBrace); this._beforeOpeningCurlyBrace = Boolean(options.beforeOpeningCurlyBrace); }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before `()` or `{}` in funct{ assert( options.beforeOpeningRoundBrace === true, this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | /**··· * Re if ('beforeOpeningCurlyBrace' in options) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before `()` or `{}` in funct{ assert( options.beforeOpeningCurlyBrace === true, this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | /**··· * Re assert( |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires space before `()` or `{}` in fuoptions.beforeOpeningRoundBrace, |
| ✓ Was returned | /**··· * Requioptions.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, |
| Function (anonymous_1110) | |
|---|---|
| ✓ Was called | /**··· * Requires spafunction() { return 'requireSpacesInFunctionDeclaration'; }, |
| Function (anonymous_1111) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var beforeOpeningRoundBrace = this._beforeOpeningRoundBrace; var beforeOpeningCurlyBrace = this._beforeOpeningCurlyBrace; file.iterateNodesByType(['FunctionDeclaration'], function(node) { // Exception for `export default function` #1376 if (!node.id) { return; } if (beforeOpeningRoundBrace) { // for a named function, use node.id var functionToken = file.getFirstNodeToken(node.id || node); if (node.async && functionToken.value === 'async') { functionToken = file.getNextToken(functionToken); } // if generator, set token to be * instead if (node.generator && functionToken.value === 'function') { functionToken = file.getNextToken(functionToken); } errors.assert.whitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Missing space before opening round brace' }); } if (beforeOpeningCurlyBrace) { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.whitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Missing space before opening curly brace' }); } }); } |
| Function (anonymous_1112) | |
|---|---|
| ✓ Was called | /**··· * Requires space before `()` or `{}` in function decfunction(node) { // Exception for `export default function` #1376 if (!node.id) { return; } if (beforeOpeningRoundBrace) { // for a named function, use node.id var functionToken = file.getFirstNodeToken(node.id || node); if (node.async && functionToken.value === 'async') { functionToken = file.getNextToken(functionToken); } // if generator, set token to be * instead if (node.generator && functionToken.value === 'function') { functionToken = file.getNextToken(functionToken); } errors.assert.whitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Missing space before opening round brace' }); } if (beforeOpeningCurlyBrace) { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.whitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Missing space before opening curly brace' }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space befo{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir if (beforeOpeningRoundBrace) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before `()` or `{}`{ // for a named function, use node.id var functionToken = file.getFirstNodeToken(node.id || node); if (node.async && functionToken.value === 'async') { functionToken = file.getNextToken(functionToken); } // if generator, set token to be * instead if (node.generator && functionToken.value === 'function') { functionToken = file.getNextToken(functionToken); } errors.assert.whitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Missing space before opening round brace' }); } |
| ✓ Negative was executed (else) | /**··· * Requir if (beforeOpeningCurlyBrace) { |
| Branch LogicalExpression | |
|---|---|
| ✗ Was not returned | /**··· * Requires space before `()` or `{}` in function declarations. *node); |
| ✓ Was returned | /**··· * Requires space before `()` or `{}` in function declanode.id || node); |
| Branch IfStatement | |
|---|---|
| ✗ Positive was not executed (if) | /**··· * Requires space before `()` or `{}` in function declarations.{ functionToken = file.getNextToken(functionToken); } |
| ✓ Negative was executed (else) | /**··· * Requires s // if generator, set token to be * instead |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires space before `()` functionToken.value === 'async') { |
| ✓ Was returned | /**··· * Requires spacnode.async && functionToken.value === 'async') { |
| Branch IfStatement | |
|---|---|
| ✗ Positive was not executed (if) | /**··· * Requires space before `()` or `{}` in function declarations. * * { functionToken = file.getNextToken(functionToken); } |
| ✓ Negative was executed (else) | /**··· * Requires s errors.assert.whitespaceBetween({ |
| Branch LogicalExpression | |
| ✗ Was not returned | /**··· * Requires space before `()` or `functionToken.value === 'function') { |
| ✓ Was returned | /**··· * Requires spacnode.generator && functionToken.value === 'function') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before `()` or `{}`{ var bodyToken = file.getFirstNodeToken(node.body); errors.assert.whitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Missing space before opening curly brace' }); } |
| ✓ Negative was executed (else) | /**··· * Requir }); |
| Function (anonymous_1113) | |
|---|---|
| ✓ Was called | /**··· * Requires sfunction() {}; |
| Function (anonymous_1114) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { assert( typeof options === 'object', this.getOptionName() + ' option must be the object' ); if ('beforeOpeningRoundBrace' in options) { assert( options.beforeOpeningRoundBrace === true, this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } if ('beforeOpeningCurlyBrace' in options) { assert( options.beforeOpeningCurlyBrace === true, this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } assert( options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, this.getOptionName() + ' must have beforeOpeningCurlyBrace or beforeOpeningRoundBrace property' ); this._beforeOpeningRoundBrace = Boolean(options.beforeOpeningRoundBrace); this._beforeOpeningCurlyBrace = Boolean(options.beforeOpeningCurlyBrace); }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before `()` or `{}` in funct{ assert( options.beforeOpeningRoundBrace === true, this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | /**··· * Re if ('beforeOpeningCurlyBrace' in options) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before `()` or `{}` in funct{ assert( options.beforeOpeningCurlyBrace === true, this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | /**··· * Re assert( |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires space before `()` or `{}` in fuoptions.beforeOpeningRoundBrace, |
| ✓ Was returned | /**··· * Requioptions.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, |
| Function (anonymous_1115) | |
|---|---|
| ✓ Was called | /**··· * Requires spafunction() { return 'requireSpacesInFunctionExpression'; }, |
| Function (anonymous_1116) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var beforeOpeningRoundBrace = this._beforeOpeningRoundBrace; var beforeOpeningCurlyBrace = this._beforeOpeningCurlyBrace; file.iterateNodesByType('FunctionExpression', function(node) { // for a named function, use node.id var functionNode = node.id || node; var parent = node.parentNode; // Ignore syntactic sugar for getters and setters. if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { return; } // shorthand or constructor methods if (parent.method || parent.type === 'MethodDefinition') { functionNode = parent.key; } if (beforeOpeningRoundBrace) { var functionToken = file.getFirstNodeToken(functionNode); if (node.async && functionToken.value === 'async') { functionToken = file.getNextToken(functionToken); } // if generator, set token to be * instead if (node.generator && functionToken.value === 'function') { functionToken = file.getNextToken(functionToken); } errors.assert.whitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Missing space before opening round brace' }); } if (beforeOpeningCurlyBrace) { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.whitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Missing space before opening curly brace' }); } }); } |
| Function (anonymous_1117) | |
|---|---|
| ✓ Was called | /**··· * Requires space before `()` or `{}` in function function(node) { // for a named function, use node.id var functionNode = node.id || node; var parent = node.parentNode; // Ignore syntactic sugar for getters and setters. if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { return; } // shorthand or constructor methods if (parent.method || parent.type === 'MethodDefinition') { functionNode = parent.key; } if (beforeOpeningRoundBrace) { var functionToken = file.getFirstNodeToken(functionNode); if (node.async && functionToken.value === 'async') { functionToken = file.getNextToken(functionToken); } // if generator, set token to be * instead if (node.generator && functionToken.value === 'function') { functionToken = file.getNextToken(functionToken); } errors.assert.whitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Missing space before opening round brace' }); } if (beforeOpeningCurlyBrace) { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.whitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Missing space before opening curly brace' }); } }); |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires space before `()` or `{}` node; |
| ✓ Was returned | /**··· * Requires space before `(node.id || node; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before `()` or `{}` in function expressions (both [named](#requirespacesin{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir // shorthand or constructor methods |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires space before `()` or `{}` in fuparent.kind === 'get' || parent.kind === 'set')) { |
| ✓ Was returned | /**··· * Requires parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires space before `()` or `{}` in function expressions (both parent.kind === 'set')) { |
| ✓ Was returned | /**··· * Requires space before `()` or `{}` in fuparent.kind === 'get' || parent.kind === 'set')) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before `()` or `{}` in function expressions (bo{ functionNode = parent.key; } |
| ✓ Negative was executed (else) | /**··· * Requir if (beforeOpeningRoundBrace) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires space before `()`parent.type === 'MethodDefinition') { |
| ✓ Was returned | /**··· * Requires parent.method || parent.type === 'MethodDefinition') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before `()` or `{}`{ var functionToken = file.getFirstNodeToken(functionNode); if (node.async && functionToken.value === 'async') { functionToken = file.getNextToken(functionToken); } // if generator, set token to be * instead if (node.generator && functionToken.value === 'function') { functionToken = file.getNextToken(functionToken); } errors.assert.whitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Missing space before opening round brace' }); } |
| ✓ Negative was executed (else) | /**··· * Requir if (beforeOpeningCurlyBrace) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before `()` or `{}` in function expressions ({ functionToken = file.getNextToken(functionToken); } |
| ✓ Negative was executed (else) | /**··· * Requires s // if generator, set token to be * instead |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires space before `()` functionToken.value === 'async') { |
| ✓ Was returned | /**··· * Requires spacnode.async && functionToken.value === 'async') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before `()` or `{}` in function expressions (both [n{ functionToken = file.getNextToken(functionToken); } |
| ✓ Negative was executed (else) | /**··· * Requires s errors.assert.whitespaceBetween({ |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires space before `()` or `functionToken.value === 'function') { |
| ✓ Was returned | /**··· * Requires spacnode.generator && functionToken.value === 'function') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before `()` or `{}`{ var bodyToken = file.getFirstNodeToken(node.body); errors.assert.whitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Missing space before opening curly brace' }); } |
| ✓ Negative was executed (else) | /**··· * Requir }); |
| Function (anonymous_1118) | |
|---|---|
| ✓ Was called | /**··· * Requires sfunction() {}; |
| Function (anonymous_1119) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { assert( typeof options === 'object', this.getOptionName() + ' option must be the object' ); if ('beforeOpeningRoundBrace' in options) { assert( options.beforeOpeningRoundBrace === true, this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } if ('beforeOpeningCurlyBrace' in options) { assert( options.beforeOpeningCurlyBrace === true, this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } assert( options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, this.getOptionName() + ' must have beforeOpeningCurlyBrace or beforeOpeningRoundBrace property' ); this._beforeOpeningRoundBrace = Boolean(options.beforeOpeningRoundBrace); this._beforeOpeningCurlyBrace = Boolean(options.beforeOpeningCurlyBrace); }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before `()` or `{}` in funct{ assert( options.beforeOpeningRoundBrace === true, this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | /**··· * Re if ('beforeOpeningCurlyBrace' in options) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before `()` or `{}` in funct{ assert( options.beforeOpeningCurlyBrace === true, this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | /**··· * Re assert( |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires space before `()` or `{}` in fuoptions.beforeOpeningRoundBrace, |
| ✓ Was returned | /**··· * Requioptions.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, |
| Function (anonymous_1120) | |
|---|---|
| ✓ Was called | /**··· * Requires spafunction() { return 'requireSpacesInFunction'; }, |
| Function (anonymous_1121) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var beforeOpeningRoundBrace = this._beforeOpeningRoundBrace; var beforeOpeningCurlyBrace = this._beforeOpeningCurlyBrace; file.iterateNodesByType(['FunctionDeclaration', 'FunctionExpression'], function(node) { // for a named function, use node.id var functionNode = node.id || node; var parent = node.parentNode; // Ignore syntactic sugar for getters and setters. if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { return; } // shorthand or constructor methods if (parent.method || parent.type === 'MethodDefinition') { functionNode = parent.key; } if (beforeOpeningRoundBrace) { var functionToken = file.getFirstNodeToken(functionNode); if (node.async && functionToken.value === 'async') { functionToken = file.getNextToken(functionToken); } // if generator, set token to be * instead if (node.generator && functionToken.value === 'function') { functionToken = file.getNextToken(functionToken); } errors.assert.whitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Missing space before opening round brace' }); } if (beforeOpeningCurlyBrace) { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.whitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Missing space before opening curly brace' }); } }); } |
| Function (anonymous_1122) | |
|---|---|
| ✓ Was called | /**··· * Requires space before `()` or `{}` in function expressions (both [named]function(node) { // for a named function, use node.id var functionNode = node.id || node; var parent = node.parentNode; // Ignore syntactic sugar for getters and setters. if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { return; } // shorthand or constructor methods if (parent.method || parent.type === 'MethodDefinition') { functionNode = parent.key; } if (beforeOpeningRoundBrace) { var functionToken = file.getFirstNodeToken(functionNode); if (node.async && functionToken.value === 'async') { functionToken = file.getNextToken(functionToken); } // if generator, set token to be * instead if (node.generator && functionToken.value === 'function') { functionToken = file.getNextToken(functionToken); } errors.assert.whitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Missing space before opening round brace' }); } if (beforeOpeningCurlyBrace) { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.whitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Missing space before opening curly brace' }); } }); |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires space before `()` or `{}` node; |
| ✓ Was returned | /**··· * Requires space before `(node.id || node; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before `()` or `{}` in function expressions (both [named](#requirespacesin{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir // shorthand or constructor methods |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires space before `()` or `{}` in fuparent.kind === 'get' || parent.kind === 'set')) { |
| ✓ Was returned | /**··· * Requires parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires space before `()` or `{}` in function expressions (both parent.kind === 'set')) { |
| ✓ Was returned | /**··· * Requires space before `()` or `{}` in fuparent.kind === 'get' || parent.kind === 'set')) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before `()` or `{}` in function expressions (bo{ functionNode = parent.key; } |
| ✓ Negative was executed (else) | /**··· * Requir if (beforeOpeningRoundBrace) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires space before `()`parent.type === 'MethodDefinition') { |
| ✓ Was returned | /**··· * Requires parent.method || parent.type === 'MethodDefinition') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before `()` or `{}`{ var functionToken = file.getFirstNodeToken(functionNode); if (node.async && functionToken.value === 'async') { functionToken = file.getNextToken(functionToken); } // if generator, set token to be * instead if (node.generator && functionToken.value === 'function') { functionToken = file.getNextToken(functionToken); } errors.assert.whitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Missing space before opening round brace' }); } |
| ✓ Negative was executed (else) | /**··· * Requir if (beforeOpeningCurlyBrace) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before `()` or `{}` in function expressions ({ functionToken = file.getNextToken(functionToken); } |
| ✓ Negative was executed (else) | /**··· * Requires s // if generator, set token to be * instead |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires space before `()` functionToken.value === 'async') { |
| ✓ Was returned | /**··· * Requires spacnode.async && functionToken.value === 'async') { |
| Branch IfStatement | |
|---|---|
| ✗ Positive was not executed (if) | /**··· * Requires space before `()` or `{}` in function expressions (both [n{ functionToken = file.getNextToken(functionToken); } |
| ✓ Negative was executed (else) | /**··· * Requires s errors.assert.whitespaceBetween({ |
| Branch LogicalExpression | |
| ✗ Was not returned | /**··· * Requires space before `()` or `functionToken.value === 'function') { |
| ✓ Was returned | /**··· * Requires spacnode.generator && functionToken.value === 'function') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before `()` or `{}`{ var bodyToken = file.getFirstNodeToken(node.body); errors.assert.whitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Missing space before opening curly brace' }); } |
| ✓ Negative was executed (else) | /**··· * Requir }); |
| Function (anonymous_1123) | |
|---|---|
| ✓ Was called | /**··· * Requires sfunction() {}; |
| Function (anonymous_1124) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { assert( typeof options === 'object', this.getOptionName() + ' option must be an object' ); if ('beforeStar' in options) { assert( options.beforeStar === true, this.getOptionName() + '.beforeStar ' + 'property requires true value or should be removed' ); } if ('afterStar' in options) { assert( options.afterStar === true, this.getOptionName() + '.afterStar ' + 'property requires true value or should be removed' ); } assert( options.beforeStar || options.afterStar, this.getOptionName() + ' must have beforeStar or afterStar property' ); this._beforeStar = options.beforeStar; this._afterStar = options.afterStar; }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before and afte{ assert( options.beforeStar === true, this.getOptionName() + '.beforeStar ' + 'property requires true value or should be removed' ); } |
| ✗ Negative was not executed (else) | /**··· * Re if ('afterStar' in options) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before and aft{ assert( options.afterStar === true, this.getOptionName() + '.afterStar ' + 'property requires true value or should be removed' ); } |
| ✗ Negative was not executed (else) | /**··· * Re assert( |
| Branch LogicalExpression | |
|---|---|
| ✗ Was not returned | /**··· * Requires space before and aoptions.afterStar, |
| ✓ Was returned | /**··· * Requioptions.beforeStar || options.afterStar, |
| Function (anonymous_1125) | |
|---|---|
| ✓ Was called | /**··· * Requires spafunction() { return 'requireSpacesInGenerator'; }, |
| Function (anonymous_1126) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var beforeStar = this._beforeStar; var afterStar = this._afterStar; file.iterateNodesByType(['FunctionDeclaration', 'FunctionExpression'], function(node) { if (!node.generator) { return; } var parent = node.parentNode; var shorthand = false; // shorthand or constructor methods if (parent.method || parent.type === 'MethodDefinition') { shorthand = true; node = parent.key; } var currentToken = file.getFirstNodeToken(node); if (node.async && currentToken.value === 'async') { currentToken = file.getNextToken(currentToken); } if (beforeStar && !shorthand) { // currentToken assigned outside of function errors.assert.whitespaceBetween({ token: currentToken, nextToken: file.getNextToken(currentToken), message: 'Missing space before star' }); } if (afterStar) { if (shorthand) { currentToken = file.getPrevToken(currentToken); } else { // currentToken reassigned for star token currentToken = file.getNextToken(currentToken); } errors.assert.whitespaceBetween({ token: currentToken, nextToken: file.getNextToken(currentToken), message: 'Missing space after star' }); } }); } |
| Function (anonymous_1127) | |
|---|---|
| ✓ Was called | /**··· * Requires space before and after `*` in generator functions * * Types: function(node) { if (!node.generator) { return; } var parent = node.parentNode; var shorthand = false; // shorthand or constructor methods if (parent.method || parent.type === 'MethodDefinition') { shorthand = true; node = parent.key; } var currentToken = file.getFirstNodeToken(node); if (node.async && currentToken.value === 'async') { currentToken = file.getNextToken(currentToken); } if (beforeStar && !shorthand) { // currentToken assigned outside of function errors.assert.whitespaceBetween({ token: currentToken, nextToken: file.getNextToken(currentToken), message: 'Missing space before star' }); } if (afterStar) { if (shorthand) { currentToken = file.getPrevToken(currentToken); } else { // currentToken reassigned for star token currentToken = file.getNextToken(currentToken); } errors.assert.whitespaceBetween({ token: currentToken, nextToken: file.getNextToken(currentToken), message: 'Missing space after star' }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before and { return; } |
| ✓ Negative was executed (else) | /**··· * Requir var parent = node.parentNode; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before and after `*` in generator functions * { shorthand = true; node = parent.key; } |
| ✓ Negative was executed (else) | /**··· * Requir var currentToken = file.getFirstNodeToken(node); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires space before and parent.type === 'MethodDefinition') { |
| ✓ Was returned | /**··· * Requires parent.method || parent.type === 'MethodDefinition') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before and after `*` in generator functi{ currentToken = file.getNextToken(currentToken); } |
| ✓ Negative was executed (else) | /**··· * Requir if (beforeStar && !shorthand) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires space before acurrentToken.value === 'async') { |
| ✓ Was returned | /**··· * Requires node.async && currentToken.value === 'async') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before and after `*`{ // currentToken assigned outside of function errors.assert.whitespaceBetween({ token: currentToken, nextToken: file.getNextToken(currentToken), message: 'Missing space before star' }); } |
| ✓ Negative was executed (else) | /**··· * Requir if (afterStar) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires space before a!shorthand) { |
| ✗ Was not returned | /**··· * Requires beforeStar && !shorthand) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space befor{ if (shorthand) { currentToken = file.getPrevToken(currentToken); } else { // currentToken reassigned for star token currentToken = file.getNextToken(currentToken); } errors.assert.whitespaceBetween({ token: currentToken, nextToken: file.getNextToken(currentToken), message: 'Missing space after star' }); } |
| ✗ Negative was not executed (else) | /**··· * Requir }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before an{ currentToken = file.getPrevToken(currentToken); } else { |
| ✓ Negative was executed (else) | /**··· * Requires space b{ // currentToken reassigned for star token currentToken = file.getNextToken(currentToken); } |
| Function (anonymous_1128) | |
|---|---|
| ✓ Was called | /**··· * Requires sfunction() {}; |
| Function (anonymous_1129) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { assert( typeof options === 'object', this.getOptionName() + ' option must be the object' ); if ('beforeOpeningRoundBrace' in options) { assert( options.beforeOpeningRoundBrace === true, this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } if ('beforeOpeningCurlyBrace' in options) { assert( options.beforeOpeningCurlyBrace === true, this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } assert( options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, this.getOptionName() + ' must have beforeOpeningCurlyBrace ' + 'or beforeOpeningRoundBrace property' ); this._beforeOpeningRoundBrace = Boolean(options.beforeOpeningRoundBrace); this._beforeOpeningCurlyBrace = Boolean(options.beforeOpeningCurlyBrace); }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before `()` or `{}` in named{ assert( options.beforeOpeningRoundBrace === true, this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | /**··· * Re if ('beforeOpeningCurlyBrace' in options) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before `()` or `{}` in named{ assert( options.beforeOpeningCurlyBrace === true, this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | /**··· * Re assert( |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires space before `()` or `{}` in naoptions.beforeOpeningRoundBrace, |
| ✓ Was returned | /**··· * Requioptions.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, |
| Function (anonymous_1130) | |
|---|---|
| ✓ Was called | /**··· * Requires spafunction() { return 'requireSpacesInNamedFunctionExpression'; }, |
| Function (anonymous_1131) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var beforeOpeningRoundBrace = this._beforeOpeningRoundBrace; var beforeOpeningCurlyBrace = this._beforeOpeningCurlyBrace; file.iterateNodesByType(['FunctionExpression'], function(node) { var functionNode = node.id; var parent = node.parentNode; // Ignore syntactic sugar for getters and setters. if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { return; } // shorthand or constructor methods if (parent.method || parent.type === 'MethodDefinition') { functionNode = parent.key; } // named function expressions only if (node.id) { if (beforeOpeningRoundBrace) { var functionToken = file.getFirstNodeToken(functionNode); if (node.async && functionToken.value === 'async') { functionToken = file.getNextToken(functionToken); } errors.assert.whitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Missing space before opening round brace' }); } if (beforeOpeningCurlyBrace) { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.whitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Missing space before opening curly brace' }); } } }); } |
| Function (anonymous_1132) | |
|---|---|
| ✓ Was called | /**··· * Requires space before `()` or `{}` in named functfunction(node) { var functionNode = node.id; var parent = node.parentNode; // Ignore syntactic sugar for getters and setters. if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { return; } // shorthand or constructor methods if (parent.method || parent.type === 'MethodDefinition') { functionNode = parent.key; } // named function expressions only if (node.id) { if (beforeOpeningRoundBrace) { var functionToken = file.getFirstNodeToken(functionNode); if (node.async && functionToken.value === 'async') { functionToken = file.getNextToken(functionToken); } errors.assert.whitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Missing space before opening round brace' }); } if (beforeOpeningCurlyBrace) { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.whitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Missing space before opening curly brace' }); } } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before `()` or `{}` in named function expressions. * * Types: `Object` { return; } |
| ✓ Negative was executed (else) | /**··· * Requir // shorthand or constructor methods |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires space before `()` or `{}` in naparent.kind === 'get' || parent.kind === 'set')) { |
| ✓ Was returned | /**··· * Requires parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires space before `()` or `{}` in named function expressions.parent.kind === 'set')) { |
| ✓ Was returned | /**··· * Requires space before `()` or `{}` in naparent.kind === 'get' || parent.kind === 'set')) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before `()` or `{}` in named function expressio{ functionNode = parent.key; } |
| ✓ Negative was executed (else) | /**··· * Requir // named function expressions only |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires space before `()`parent.type === 'MethodDefinition') { |
| ✓ Was returned | /**··· * Requires parent.method || parent.type === 'MethodDefinition') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space bef{ if (beforeOpeningRoundBrace) { var functionToken = file.getFirstNodeToken(functionNode); if (node.async && functionToken.value === 'async') { functionToken = file.getNextToken(functionToken); } errors.assert.whitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Missing space before opening round brace' }); } if (beforeOpeningCurlyBrace) { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.whitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Missing space before opening curly brace' }); } } |
| ✓ Negative was executed (else) | /**··· * Requir }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before `()` or `{}` in { var functionToken = file.getFirstNodeToken(functionNode); if (node.async && functionToken.value === 'async') { functionToken = file.getNextToken(functionToken); } errors.assert.whitespaceBetween({ token: functionToken, nextToken: file.getNextToken(functionToken), message: 'Missing space before opening round brace' }); } |
| ✓ Negative was executed (else) | /**··· * Requires s if (beforeOpeningCurlyBrace) { |
| Branch IfStatement | |
|---|---|
| ✗ Positive was not executed (if) | /**··· * Requires space before `()` or `{}` in named function expressions{ functionToken = file.getNextToken(functionToken); } |
| ✓ Negative was executed (else) | /**··· * Requires space errors.assert.whitespaceBetween({ |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires space before `()` or `functionToken.value === 'async') { |
| ✓ Was returned | /**··· * Requires space benode.async && functionToken.value === 'async') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space before `()` or `{}` in { var bodyToken = file.getFirstNodeToken(node.body); errors.assert.whitespaceBetween({ token: file.getPrevToken(bodyToken), nextToken: bodyToken, message: 'Missing space before opening curly brace' }); } |
| ✓ Negative was executed (else) | /**··· * Requires s } |
| Function (anonymous_1133) | |
|---|---|
| ✓ Was called | /**··· * Requires sfunction() {}; |
| Function (anonymous_1134) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(value) { var mode; var modes = { 'all': true, 'allButNested': true }; var isObject = typeof value === 'object'; var error = this.getOptionName() + ' rule' + ' requires string value "all" or "allButNested" or object'; if (typeof value === 'string') { assert(modes[value], error); } else if (isObject) { assert('allExcept' in value, error); } else { assert(false, error); } this._exceptions = {}; if (isObject) { (value.allExcept || []).forEach(function(value) { this._exceptions[value] = true; }, this); } else { mode = value; } if (mode === 'allButNested') { this._exceptions['['] = this._exceptions[']'] = true; } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space after opening arr{ assert(modes[value], error); } else if (isObject) { |
| ✓ Negative was executed (else) | /**··· * Requiresif (isObject) { assert('allExcept' in value, error); } else { assert(false, error); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space after o{ assert('allExcept' in value, error); } else { |
| ✓ Negative was executed (else) | /**··· * Requires{ assert(false, error); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space { (value.allExcept || []).forEach(function(value) { this._exceptions[value] = true; }, this); } else { |
| ✓ Negative was executed (else) | /**··· * Requires{ mode = value; } |
| Function (anonymous_1135) | |
|---|---|
| ✓ Was called | /**··· * Requires space after opening array sqfunction(value) { this._exceptions[value] = true; }, this); |
| Branch LogicalExpression | |
| ✗ Was not returned | /**··· * Requires space after open[]).forEach(function(value) { |
| ✓ Was returned | /**··· * Requirvalue.allExcept || []).forEach(function(value) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space after opening a{ this._exceptions['['] = this._exceptions[']'] = true; } |
| ✓ Negative was executed (else) | /**··· * Re }, |
| Function (anonymous_1136) | |
|---|---|
| ✓ Was called | /**··· * Requires spafunction() { return 'requireSpacesInsideArrayBrackets'; }, |
| Function (anonymous_1137) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var exceptions = this._exceptions; file.iterateNodesByType('ArrayExpression', function(node) { var openBracket = file.getFirstNodeToken(node); var afterOpen = file.getNextToken(openBracket, {includeComments: true}); var closeBracket = file.getLastNodeToken(node); var beforeClose = file.getPrevToken(closeBracket, {includeComments: true}); // Skip for empty array brackets if (afterOpen.value === ']') { return; } if (!(afterOpen.value in exceptions)) { errors.assert.spacesBetween({ token: openBracket, nextToken: afterOpen, exactly: 1, message: 'One space required after opening bracket' }); } if (!(beforeClose.value in exceptions)) { errors.assert.spacesBetween({ token: beforeClose, nextToken: closeBracket, exactly: 1, message: 'One space required before closing bracket' }); } }); } |
| Function (anonymous_1138) | |
|---|---|
| ✓ Was called | /**··· * Requires space after opening array square brfunction(node) { var openBracket = file.getFirstNodeToken(node); var afterOpen = file.getNextToken(openBracket, {includeComments: true}); var closeBracket = file.getLastNodeToken(node); var beforeClose = file.getPrevToken(closeBracket, {includeComments: true}); // Skip for empty array brackets if (afterOpen.value === ']') { return; } if (!(afterOpen.value in exceptions)) { errors.assert.spacesBetween({ token: openBracket, nextToken: afterOpen, exactly: 1, message: 'One space required after opening bracket' }); } if (!(beforeClose.value in exceptions)) { errors.assert.spacesBetween({ token: beforeClose, nextToken: closeBracket, exactly: 1, message: 'One space required before closing bracket' }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space after opening array{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir if (!(afterOpen.value in exceptions)) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space after opening array square b{ errors.assert.spacesBetween({ token: openBracket, nextToken: afterOpen, exactly: 1, message: 'One space required after opening bracket' }); } |
| ✓ Negative was executed (else) | /**··· * Requir if (!(beforeClose.value in exceptions)) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space after opening array square bra{ errors.assert.spacesBetween({ token: beforeClose, nextToken: closeBracket, exactly: 1, message: 'One space required before closing bracket' }); } |
| ✓ Negative was executed (else) | /**··· * Requir }); |
| Function (anonymous_1139) | |
|---|---|
| ✓ Was called | /**··· * Requires sfunction() {}; |
| Function (anonymous_1140) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(value) { var isObject = typeof value === 'object'; var error = this.getOptionName() + ' rule requires string value true or object'; if (isObject) { assert('allExcept' in value, error); } else { assert(value === true, error); } this._exceptions = {}; if (isObject) { (value.allExcept || []).forEach(function(value) { this._exceptions[value] = true; }, this); } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space { assert('allExcept' in value, error); } else { |
| ✓ Negative was executed (else) | /**··· * Requires{ assert(value === true, error); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space { (value.allExcept || []).forEach(function(value) { this._exceptions[value] = true; }, this); } |
| ✓ Negative was executed (else) | /**··· * Re }, |
| Function (anonymous_1141) | |
|---|---|
| ✓ Was called | /**··· * Requires space after opening square bfunction(value) { this._exceptions[value] = true; }, this); |
| Branch LogicalExpression | |
| ✗ Was not returned | /**··· * Requires space after open[]).forEach(function(value) { |
| ✓ Was returned | /**··· * Requirvalue.allExcept || []).forEach(function(value) { |
| Function (anonymous_1142) | |
|---|---|
| ✓ Was called | /**··· * Requires spafunction() { return 'requireSpacesInsideBrackets'; }, |
| Function (anonymous_1143) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var exceptions = this._exceptions; file.iterateTokenByValue('[', function(token) { var nextToken = file.getNextToken(token, { includeComments: true }); var value = nextToken.value; if (value in exceptions) { return; } // Skip for empty array brackets if (value === ']') { return; } errors.assert.spacesBetween({ token: token, nextToken: nextToken, exactly: 1, message: 'One space required after opening bracket' }); }); file.iterateTokenByValue(']', function(token) { var prevToken = file.getPrevToken(token, { includeComments: true }); var value = prevToken.value; if (value in exceptions) { return; } // Skip for empty array brackets if (value === '[') { return; } errors.assert.spacesBetween({ token: prevToken, nextToken: token, exactly: 1, message: 'One space required before closing bracket' }); }); } |
| Function (anonymous_1144) | |
|---|---|
| ✓ Was called | /**··· * Requires space after opening sqfunction(token) { var nextToken = file.getNextToken(token, { includeComments: true }); var value = nextToken.value; if (value in exceptions) { return; } // Skip for empty array brackets if (value === ']') { return; } errors.assert.spacesBetween({ token: token, nextToken: nextToken, exactly: 1, message: 'One space required after opening bracket' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space after opening s{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir // Skip for empty array brackets |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space after ope{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir errors.assert.spacesBetween({ |
| Function (anonymous_1145) | |
|---|---|
| ✓ Was called | /**··· * Requires space after opening sqfunction(token) { var prevToken = file.getPrevToken(token, { includeComments: true }); var value = prevToken.value; if (value in exceptions) { return; } // Skip for empty array brackets if (value === '[') { return; } errors.assert.spacesBetween({ token: prevToken, nextToken: token, exactly: 1, message: 'One space required before closing bracket' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space after opening s{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir // Skip for empty array brackets |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space after ope{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir errors.assert.spacesBetween({ |
| Function (anonymous_1146) | |
|---|---|
| ✓ Was called | /**··· * Requires sfunction() {}; |
| Function (anonymous_1147) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(value) { var mode; var modes = { 'all': true, 'allButNested': true }; var isObject = typeof value === 'object'; var error = this.getOptionName() + ' rule' + ' requires string value \'all\' or \'allButNested\' or object'; if (typeof value === 'string') { assert(modes[value], error); } else if (isObject) { assert('allExcept' in value, error); } else { assert(false, error); } this._exceptions = {}; if (isObject) { (value.allExcept || []).forEach(function(value) { this._exceptions[value] = true; }, this); } else { mode = value; } if (mode === 'allButNested') { this._exceptions['}'] = true; } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space after opening obj{ assert(modes[value], error); } else if (isObject) { |
| ✓ Negative was executed (else) | /**··· * Requiresif (isObject) { assert('allExcept' in value, error); } else { assert(false, error); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space after o{ assert('allExcept' in value, error); } else { |
| ✓ Negative was executed (else) | /**··· * Requires{ assert(false, error); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space { (value.allExcept || []).forEach(function(value) { this._exceptions[value] = true; }, this); } else { |
| ✓ Negative was executed (else) | /**··· * Requires{ mode = value; } |
| Function (anonymous_1148) | |
|---|---|
| ✓ Was called | /**··· * Requires space after opening object cfunction(value) { this._exceptions[value] = true; }, this); |
| Branch LogicalExpression | |
| ✗ Was not returned | /**··· * Requires space after open[]).forEach(function(value) { |
| ✓ Was returned | /**··· * Requirvalue.allExcept || []).forEach(function(value) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space after opening o{ this._exceptions['}'] = true; } |
| ✓ Negative was executed (else) | /**··· * Re }, |
| Function (anonymous_1149) | |
|---|---|
| ✓ Was called | /**··· * Requires spafunction() { return 'requireSpacesInsideObjectBrackets'; }, |
| Function (anonymous_1150) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var exceptions = this._exceptions; file.iterateNodesByType(['ObjectExpression', 'ObjectPattern'], function(node) { var openingBracket = file.getFirstNodeToken(node); var nextToken = file.getNextToken(openingBracket); // Don't check empty object if (nextToken.value === '}') { return; } errors.assert.spacesBetween({ token: openingBracket, nextToken: nextToken, exactly: 1, message: 'One space required after opening curly brace' }); var closingBracket = file.getLastNodeToken(node); var prevToken = file.getPrevToken(closingBracket); if (prevToken.value in exceptions) { return; } errors.assert.spacesBetween({ token: prevToken, nextToken: closingBracket, exactly: 1, message: 'One space required before closing curly brace' }); }); } |
| Function (anonymous_1151) | |
|---|---|
| ✓ Was called | /**··· * Requires space after opening object curly brace and before closifunction(node) { var openingBracket = file.getFirstNodeToken(node); var nextToken = file.getNextToken(openingBracket); // Don't check empty object if (nextToken.value === '}') { return; } errors.assert.spacesBetween({ token: openingBracket, nextToken: nextToken, exactly: 1, message: 'One space required after opening curly brace' }); var closingBracket = file.getLastNodeToken(node); var prevToken = file.getPrevToken(closingBracket); if (prevToken.value in exceptions) { return; } errors.assert.spacesBetween({ token: prevToken, nextToken: closingBracket, exactly: 1, message: 'One space required before closing curly brace' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space after opening objec{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir errors.assert.spacesBetween({ |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space after opening object curl{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir errors.assert.spacesBetween({ |
| Function (anonymous_1152) | |
|---|---|
| ✓ Was called | /**··· * Requires sfunction() {}; |
| Function (anonymous_1153) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(value) { var mode; var modes = { 'all': true, 'allButNested': true }; var isObject = typeof value === 'object'; var error = this.getOptionName() + ' rule' + ' requires string value \'all\' or \'allButNested\' or object'; if (typeof value === 'string') { assert(modes[value], error); } else if (isObject) { assert( 'all' in value || 'allButNested' in value, error ); } else { assert(false, error); } this._exceptions = {}; this._exceptSingleQuote = false; this._exceptDoubleQuote = false; this._ignoreParenthesizedExpression = false; if (isObject) { mode = 'all' in value ? 'all' : 'allButNested'; (value.except || []).forEach(function(value) { if (value === '\'') { this._exceptSingleQuote = true; } if (value === '"') { this._exceptDoubleQuote = true; } this._exceptions[value] = true; }, this); if (value.ignoreParenthesizedExpression === true) { this._ignoreParenthesizedExpression = true; } } else { mode = value; } if (mode === 'allButNested') { this._exceptions[')'] = this._exceptions['('] = true; } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space after opening rou{ assert(modes[value], error); } else if (isObject) { |
| ✓ Negative was executed (else) | /**··· * Requiresif (isObject) { assert( 'all' in value || 'allButNested' in value, error ); } else { assert(false, error); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space after o{ assert( 'all' in value || 'allButNested' in value, error ); } else { |
| ✓ Negative was executed (else) | /**··· * Requires{ assert(false, error); } |
| Branch LogicalExpression | |
|---|---|
| ✗ Was not returned | /**··· * Requires space after openin'allButNested' in value, |
| ✓ Was returned | /**··· * Requires 'all' in value || 'allButNested' in value, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space { mode = 'all' in value ? 'all' : 'allButNested'; (value.except || []).forEach(function(value) { if (value === '\'') { this._exceptSingleQuote = true; } if (value === '"') { this._exceptDoubleQuote = true; } this._exceptions[value] = true; }, this); if (value.ignoreParenthesizedExpression === true) { this._ignoreParenthesizedExpression = true; } } else { |
| ✓ Negative was executed (else) | /**··· * Requires{ mode = value; } |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | /**··· * Requires space after opening 'all' : 'allButNested'; |
| ✗ Negative was not returned (: ...) | /**··· * Requires space after opening round br'allButNested'; |
| Function (anonymous_1154) | |
|---|---|
| ✓ Was called | /**··· * Requires space after opening roundfunction(value) { if (value === '\'') { this._exceptSingleQuote = true; } if (value === '"') { this._exceptDoubleQuote = true; } this._exceptions[value] = true; }, this); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires space after o[]).forEach(function(value) { |
| ✓ Was returned | /**··· * Requirvalue.except || []).forEach(function(value) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space after opening { this._exceptSingleQuote = true; } |
| ✓ Negative was executed (else) | /**··· * Requires s if (value === '"') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space after opening{ this._exceptDoubleQuote = true; } |
| ✓ Negative was executed (else) | /**··· * Requires s this._exceptions[value] = true; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space after opening round bracket and before c{ this._ignoreParenthesizedExpression = true; } |
| ✓ Negative was executed (else) | /**··· * Requir } else { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space after opening r{ this._exceptions[')'] = this._exceptions['('] = true; } |
| ✓ Negative was executed (else) | /**··· * Re }, |
| Function (anonymous_1155) | |
|---|---|
| ✓ Was called | /**··· * Requires spafunction() { return 'requireSpacesInsideParentheses'; }, |
| Function (anonymous_1156) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var exceptions = this._exceptions; var singleQuote = this._exceptSingleQuote; var doubleQuote = this._exceptDoubleQuote; var ignoreParenthesizedExpression = this._ignoreParenthesizedExpression; file.iterateTokenByValue('(', function(token) { var nextToken = file.getNextToken(token, {includeComments: true}); var value = nextToken.value; if ( ignoreParenthesizedExpression && TokenCategorizer.categorizeOpenParen(token, file) === 'ParenthesizedExpression' ) { return; } if (value in exceptions) { return; } if (doubleQuote && nextToken.type === 'String' && value[0] === '"') { return; } if (singleQuote && nextToken.type === 'String' && value[0] === '\'') { return; } // Skip for empty parentheses if (value === ')') { return; } errors.assert.whitespaceBetween({ token: token, nextToken: nextToken, message: 'Missing space after opening round bracket' }); }); file.iterateTokenByValue(')', function(token) { var prevToken = file.getPrevToken(token, {includeComments: true}); var value = prevToken.value; if ( ignoreParenthesizedExpression && TokenCategorizer.categorizeCloseParen(token, file) === 'ParenthesizedExpression' ) { return; } if (value in exceptions) { // Special case - foo( object[i] ) if (!( value === ']' && file.getNodeByRange(token.range[0] - 1).type === 'MemberExpression' )) { return; } } if (doubleQuote && prevToken.type === 'String' && value[value.length - 1] === '"') { return; } if (singleQuote && prevToken.type === 'String' && value[value.length - 1] === '\'') { return; } // Skip for empty parentheses if (value === '(') { return; } errors.assert.whitespaceBetween({ token: prevToken, nextToken: token, message: 'Missing space before closing round bracket' }); }); } |
| Function (anonymous_1157) | |
|---|---|
| ✓ Was called | /**··· * Requires space after opening rofunction(token) { var nextToken = file.getNextToken(token, {includeComments: true}); var value = nextToken.value; if ( ignoreParenthesizedExpression && TokenCategorizer.categorizeOpenParen(token, file) === 'ParenthesizedExpression' ) { return; } if (value in exceptions) { return; } if (doubleQuote && nextToken.type === 'String' && value[0] === '"') { return; } if (singleQuote && nextToken.type === 'String' && value[0] === '\'') { return; } // Skip for empty parentheses if (value === ')') { return; } errors.assert.whitespaceBetween({ token: token, nextToken: nextToken, message: 'Missing space after opening round bracket' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Require{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir if (value in exceptions) { |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires TokenCategorizer.categorizeOpenParen(token, file) === 'ParenthesizedExpression' |
| ✓ Was returned | /**··· * Requires ignoreParenthesizedExpression && |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space after opening r{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir if (doubleQuote && nextToken.type === 'String' && value[0] === '"') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space after opening round bracket and before closing. * * Type{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir if (singleQuote && nextToken.type === 'String' && value[0] === '\'') { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires space after opening round bracket and before cvalue[0] === '"') { |
| ✓ Was returned | /**··· * Requires doubleQuote && nextToken.type === 'String' && value[0] === '"') { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires space after openextToken.type === 'String' && value[0] === '"') { |
| ✓ Was returned | /**··· * Requires doubleQuote && nextToken.type === 'String' && value[0] === '"') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space after opening round bracket and before closing. * * Types{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir // Skip for empty parentheses |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires space after opening round bracket and before cvalue[0] === '\'') { |
| ✓ Was returned | /**··· * Requires singleQuote && nextToken.type === 'String' && value[0] === '\'') { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires space after openextToken.type === 'String' && value[0] === '\'') { |
| ✓ Was returned | /**··· * Requires singleQuote && nextToken.type === 'String' && value[0] === '\'') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space after ope{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir errors.assert.whitespaceBetween({ |
| Function (anonymous_1158) | |
|---|---|
| ✓ Was called | /**··· * Requires space after opening rofunction(token) { var prevToken = file.getPrevToken(token, {includeComments: true}); var value = prevToken.value; if ( ignoreParenthesizedExpression && TokenCategorizer.categorizeCloseParen(token, file) === 'ParenthesizedExpression' ) { return; } if (value in exceptions) { // Special case - foo( object[i] ) if (!( value === ']' && file.getNodeByRange(token.range[0] - 1).type === 'MemberExpression' )) { return; } } if (doubleQuote && prevToken.type === 'String' && value[value.length - 1] === '"') { return; } if (singleQuote && prevToken.type === 'String' && value[value.length - 1] === '\'') { return; } // Skip for empty parentheses if (value === '(') { return; } errors.assert.whitespaceBetween({ token: prevToken, nextToken: token, message: 'Missing space before closing round bracket' }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Require{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir if (value in exceptions) { |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires TokenCategorizer.categorizeCloseParen(token, file) === 'ParenthesizedExpression' |
| ✓ Was returned | /**··· * Requires ignoreParenthesizedExpression && |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space after opening r{ // Special case - foo( object[i] ) if (!( value === ']' && file.getNodeByRange(token.range[0] - 1).type === 'MemberExpression' )) { return; } } |
| ✓ Negative was executed (else) | /**··· * Requir if (doubleQuote && prevToken.type === 'String' && value[value.length - 1] === '"') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires spa{ return; } |
| ✓ Negative was executed (else) | /**··· * Requires s } |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires spacfile.getNodeByRange(token.range[0] - 1).type === 'MemberExpression' |
| ✓ Was returned | /**··· * Requires spacvalue === ']' && |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space after opening round bracket and before closing. * * Types: `String` or { return; } |
| ✓ Negative was executed (else) | /**··· * Requir if (singleQuote && prevToken.type === 'String' && value[value.length - 1] === '\'') { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires space after opening round bracket and before cvalue[value.length - 1] === '"') { |
| ✓ Was returned | /**··· * Requires doubleQuote && prevToken.type === 'String' && value[value.length - 1] === '"') { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires space after opeprevToken.type === 'String' && value[value.length - 1] === '"') { |
| ✓ Was returned | /**··· * Requires doubleQuote && prevToken.type === 'String' && value[value.length - 1] === '"') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space after opening round bracket and before closing. * * Types: `String` or `{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir // Skip for empty parentheses |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires space after opening round bracket and before cvalue[value.length - 1] === '\'') { |
| ✓ Was returned | /**··· * Requires singleQuote && prevToken.type === 'String' && value[value.length - 1] === '\'') { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires space after opeprevToken.type === 'String' && value[value.length - 1] === '\'') { |
| ✓ Was returned | /**··· * Requires singleQuote && prevToken.type === 'String' && value[value.length - 1] === '\'') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space after ope{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir errors.assert.whitespaceBetween({ |
| Function (anonymous_1159) | |
|---|---|
| ✓ Was called | /**··· * Requires sfunction() {}; |
| Function (anonymous_1160) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(value) { var isObject = typeof value === 'object'; var error = this.getOptionName() + ' rule requires string value true or object'; if (isObject) { assert('allExcept' in value, error); } else { assert(value === true, error); } this._exceptions = {}; if (isObject) { (value.allExcept || []).forEach(function(value) { this._exceptions[value] = true; }, this); } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space { assert('allExcept' in value, error); } else { |
| ✓ Negative was executed (else) | /**··· * Requires{ assert(value === true, error); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space { (value.allExcept || []).forEach(function(value) { this._exceptions[value] = true; }, this); } |
| ✓ Negative was executed (else) | /**··· * Re }, |
| Function (anonymous_1161) | |
|---|---|
| ✓ Was called | /**··· * Requires space after opening and befofunction(value) { this._exceptions[value] = true; }, this); |
| Branch LogicalExpression | |
| ✗ Was not returned | /**··· * Requires space after open[]).forEach(function(value) { |
| ✓ Was returned | /**··· * Requirvalue.allExcept || []).forEach(function(value) { |
| Function (anonymous_1162) | |
|---|---|
| ✓ Was called | /**··· * Requires spafunction() { return 'requireSpacesInsideParenthesizedExpression'; }, |
| Function (anonymous_1163) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var exceptions = this._exceptions; file.iterateTokenByValue('(', function(token) { var nextToken = file.getNextToken(token, {includeComments: true}); var value = nextToken.isComment ? nextToken.type === 'Block' ? '/*' : '//' : nextToken.value; // Skip empty parentheses and explicit exceptions if (value === ')' || value in exceptions) { return; } // Skip non-expression parentheses var type = TokenCategorizer.categorizeOpenParen(token, file); if (type !== 'ParenthesizedExpression') { return; } errors.assert.whitespaceBetween({ token: token, nextToken: nextToken, message: 'Missing space after opening grouping parenthesis' }); }); file.iterateTokenByValue(')', function(token) { var prevToken = file.getPrevToken(token, {includeComments: true}); var value = prevToken.isComment ? prevToken.type === 'Block' ? '*/' : '' : prevToken.value; // Skip empty parentheses and explicit exceptions if (value === '(' || value in exceptions) { return; } // Skip non-expression parentheses var type = TokenCategorizer.categorizeCloseParen(token, file); if (type !== 'ParenthesizedExpression') { return; } errors.assert.whitespaceBetween({ token: prevToken, nextToken: token, message: 'Missing space before closing grouping parenthesis' }); }); } |
| Function (anonymous_1164) | |
|---|---|
| ✓ Was called | /**··· * Requires space after opening anfunction(token) { var nextToken = file.getNextToken(token, {includeComments: true}); var value = nextToken.isComment ? nextToken.type === 'Block' ? '/*' : '//' : nextToken.value; // Skip empty parentheses and explicit exceptions if (value === ')' || value in exceptions) { return; } // Skip non-expression parentheses var type = TokenCategorizer.categorizeOpenParen(token, file); if (type !== 'ParenthesizedExpression') { return; } errors.assert.whitespaceBetween({ token: token, nextToken: nextToken, message: 'Missing space after opening grouping parenthesis' }); }); |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | /**··· * Requires nextToken.type === 'Block' ? '/*' : '//' : |
| ✓ Negative was returned (: ...) | /**··· * Requires nextToken.value; |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | /**··· * Requires space after opening and befor'/*' : '//' : |
| ✓ Negative was returned (: ...) | /**··· * Requires space after opening and before closi'//' : |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space after opening and before closing{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir // Skip non-expression parentheses |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires space after openivalue in exceptions) { |
| ✓ Was returned | /**··· * Requires value === ')' || value in exceptions) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space after opening and before closi{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir errors.assert.whitespaceBetween({ |
| Function (anonymous_1165) | |
|---|---|
| ✓ Was called | /**··· * Requires space after opening anfunction(token) { var prevToken = file.getPrevToken(token, {includeComments: true}); var value = prevToken.isComment ? prevToken.type === 'Block' ? '*/' : '' : prevToken.value; // Skip empty parentheses and explicit exceptions if (value === '(' || value in exceptions) { return; } // Skip non-expression parentheses var type = TokenCategorizer.categorizeCloseParen(token, file); if (type !== 'ParenthesizedExpression') { return; } errors.assert.whitespaceBetween({ token: prevToken, nextToken: token, message: 'Missing space before closing grouping parenthesis' }); }); |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | /**··· * Requires prevToken.type === 'Block' ? '*/' : '' : |
| ✓ Negative was returned (: ...) | /**··· * Requires prevToken.value; |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | /**··· * Requires space after opening and befor'*/' : '' : |
| ✓ Negative was returned (: ...) | /**··· * Requires space after opening and before closi'' : |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space after opening and before closing{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir // Skip non-expression parentheses |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires space after openivalue in exceptions) { |
| ✓ Was returned | /**··· * Requires value === '(' || value in exceptions) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires space after opening and before closi{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir errors.assert.whitespaceBetween({ |
| Function (anonymous_1166) | |
|---|---|
| ✓ Was called | /**··· * Disallows function() {}; |
| Function (anonymous_1167) | |
|---|---|
| ✓ Was called | /**··· * Disallowfunction(options) { assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); }, |
| Function (anonymous_1168) | |
|---|---|
| ✓ Was called | /**··· * Disallows usfunction() { return 'requireSpread'; }, |
| Function (anonymous_1169) | |
|---|---|
| ✓ Was called | /**··· * Disafunction(file, errors) { file.iterateNodesByType('CallExpression', function(node) { var callee = node.callee; var firstParameter = node.arguments[0]; if (node.arguments.length === 2 && callee.property && callee.property.name === 'apply' && callee.object && callee.object.name === firstParameter.name) { errors.add( 'Illegal use of apply method. Use the spread operator instead', node.callee.property.loc.start ); } }); } |
| Function (anonymous_1170) | |
|---|---|
| ✓ Was called | /**··· * Disallows using `.apply` in favor of the spfunction(node) { var callee = node.callee; var firstParameter = node.arguments[0]; if (node.arguments.length === 2 && callee.property && callee.property.name === 'apply' && callee.object && callee.object.name === firstParameter.name) { errors.add( 'Illegal use of apply method. Use the spread operator instead', node.callee.property.loc.start ); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Disallows using `.apply` in favor of the spread operator * * Types: { errors.add( 'Illegal use of apply method. Use the spread operator instead', node.callee.property.loc.start ); } |
| ✓ Negative was executed (else) | /**··· * Disall }); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows using `.apply` icallee.object.name === firstParameter.name) { |
| ✓ Was returned | /**··· * Disallowsnode.arguments.length === 2 && callee.property && callee.property.name === 'apply' && callee.object && callee.object.name === firstParameter.name) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallowscallee.object && callee.object.name === firstParameter.name) { |
| ✓ Was returned | /**··· * Disallowsnode.arguments.length === 2 && callee.property && callee.property.name === 'apply' && |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallows using `.apply` in callee.property.name === 'apply' && |
| ✓ Was returned | /**··· * Disallowsnode.arguments.length === 2 && callee.property && callee.property.name === 'apply' && |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Disallowscallee.property && callee.property.name === 'apply' && |
| ✓ Was returned | /**··· * Disallowsnode.arguments.length === 2 && |
| Function (anonymous_1171) | |
|---|---|
| ✓ Was called | /**··· * Requires tfunction() {}; |
| Function (anonymous_1172) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { this._allowStringConcatenation = false; var optionName = this.getOptionName(); if (typeof options === 'object') { assert(Array.isArray(options.allExcept), optionName + ' option requires "allExcept" ' + 'to be an array'); assert(options.allExcept.length > 0, optionName + ' option requires "allExcept" ' + 'to have at least one item or be set to `true`'); options.allExcept.forEach(function(except) { if (except === 'stringConcatenation') { this._allowStringConcatenation = true; } else { assert(false, optionName + ' option requires "allExcept" to only have ' + '"stringConcatenation"'); } }, this); } else { assert( options === true, optionName + ' option requires true value or object' ); } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires the use of template strin{ assert(Array.isArray(options.allExcept), optionName + ' option requires "allExcept" ' + 'to be an array'); assert(options.allExcept.length > 0, optionName + ' option requires "allExcept" ' + 'to have at least one item or be set to `true`'); options.allExcept.forEach(function(except) { if (except === 'stringConcatenation') { this._allowStringConcatenation = true; } else { assert(false, optionName + ' option requires "allExcept" to only have ' + '"stringConcatenation"'); } }, this); } else { |
| ✓ Negative was executed (else) | /**··· * Requires{ assert( options === true, optionName + ' option requires true value or object' ); } |
| Function (anonymous_1173) | |
|---|---|
| ✓ Was called | /**··· * Requires the use of template stfunction(except) { if (except === 'stringConcatenation') { this._allowStringConcatenation = true; } else { assert(false, optionName + ' option requires "allExcept" to only have ' + '"stringConcatenation"'); } }, this); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires the use of template strings instead of{ this._allowStringConcatenation = true; } else { |
| ✓ Negative was executed (else) | /**··· * Requires the use{ assert(false, optionName + ' option requires "allExcept" to only have ' + '"stringConcatenation"'); } |
| Function (anonymous_1174) | |
|---|---|
| ✓ Was called | /**··· * Requires thefunction() { return 'requireTemplateStrings'; }, |
| Function (anonymous_1175) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var allowStringConcatenation = this._allowStringConcatenation; function add(node) { errors.add( 'Illegal use of string concatenation. Use template strings instead.', node.left.loc.end ); } file.iterateNodesByType('BinaryExpression', function(node) { if (node.operator !== '+') { return; } var leftIsString = node.left; var rightIsString = node.right; // Left side could also be binary expression (See gh-2050), // but not the right one while (leftIsString.type === 'BinaryExpression') { leftIsString = leftIsString.left; } leftIsString = typeof leftIsString.value === 'string' || leftIsString.type === 'TemplateLiteral'; rightIsString = typeof rightIsString.value === 'string' || rightIsString.type === 'TemplateLiteral'; if (allowStringConcatenation && leftIsString && rightIsString) { return; } // At least one of the operands should be a string or template string, // otherwise this is not a concatenation if (leftIsString || rightIsString) { add(node); } }); } |
| Function add | |
|---|---|
| ✓ Was called | /**··· * Rfunction add(node) { errors.add( 'Illegal use of string concatenation. Use template strings instead.', node.left.loc.end ); } |
| Function (anonymous_1177) | |
|---|---|
| ✓ Was called | /**··· * Requires the use of template strings instead function(node) { if (node.operator !== '+') { return; } var leftIsString = node.left; var rightIsString = node.right; // Left side could also be binary expression (See gh-2050), // but not the right one while (leftIsString.type === 'BinaryExpression') { leftIsString = leftIsString.left; } leftIsString = typeof leftIsString.value === 'string' || leftIsString.type === 'TemplateLiteral'; rightIsString = typeof rightIsString.value === 'string' || rightIsString.type === 'TemplateLiteral'; if (allowStringConcatenation && leftIsString && rightIsString) { return; } // At least one of the operands should be a string or template string, // otherwise this is not a concatenation if (leftIsString || rightIsString) { add(node); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires the use of template str{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir var leftIsString = node.left; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires leftIsString.type === 'TemplateLiteral'; |
| ✓ Was returned | /**··· * Requires the use of typeof leftIsString.value === 'string' || |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires rightIsString.type === 'TemplateLiteral'; |
| ✓ Was returned | /**··· * Requires the use of ttypeof rightIsString.value === 'string' || |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires the use of template strings instead of string concatenation{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir // At least one of the operands should be a string or template string, |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires the use of template strings instead of strinrightIsString) { |
| ✓ Was returned | /**··· * Requires allowStringConcatenation && leftIsString && rightIsString) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires the use of template strings leftIsString && rightIsString) { |
| ✓ Was returned | /**··· * Requires allowStringConcatenation && leftIsString && rightIsString) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires the use of template strings ins{ add(node); } |
| ✓ Negative was executed (else) | /**··· * Requir }); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires the use of templrightIsString) { |
| ✓ Was returned | /**··· * Requires leftIsString || rightIsString) { |
| Function (anonymous_1178) | |
|---|---|
| ✓ Was called | /**··· * Requires afunction() {}; |
| Function (anonymous_1179) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { if (typeof options === 'object') { if ('ignoreSingleValue' in options) { assert( options.ignoreSingleValue === true, this.getOptionName() + ' option ignoreSingleValue requires true value or should be removed' ); this._ignoreSingleValue = true; } if ('ignoreSingleLine' in options) { assert( options.ignoreSingleLine === true, this.getOptionName() + ' option ignoreSingleLine requires true value or should be removed' ); this._ignoreSingleLine = true; } } else { assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); } }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires an extra comma following { if ('ignoreSingleValue' in options) { assert( options.ignoreSingleValue === true, this.getOptionName() + ' option ignoreSingleValue requires true value or should be removed' ); this._ignoreSingleValue = true; } if ('ignoreSingleLine' in options) { assert( options.ignoreSingleLine === true, this.getOptionName() + ' option ignoreSingleLine requires true value or should be removed' ); this._ignoreSingleLine = true; } } else { |
| ✓ Negative was executed (else) | /**··· * Requires{ assert( options === true, this.getOptionName() + ' option requires a true value or should be removed' ); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires an extra comma following the fin{ assert( options.ignoreSingleValue === true, this.getOptionName() + ' option ignoreSingleValue requires true value or should be removed' ); this._ignoreSingleValue = true; } |
| ✓ Negative was executed (else) | /**··· * Requir if ('ignoreSingleLine' in options) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires an extra comma following the fi{ assert( options.ignoreSingleLine === true, this.getOptionName() + ' option ignoreSingleLine requires true value or should be removed' ); this._ignoreSingleLine = true; } |
| ✓ Negative was executed (else) | /**··· * Requir } else { |
| Function (anonymous_1180) | |
|---|---|
| ✓ Was called | /**··· * Requires an function() { return 'requireTrailingComma'; }, |
| Function (anonymous_1181) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var _this = this; file.iterateNodesByType([ 'ObjectExpression', 'ArrayExpression', 'ObjectPattern', 'ArrayPattern' ], function(node) { var isLikeObject = node.type === 'ObjectExpression' || node.type === 'ObjectPattern'; var entities = isLikeObject ? node.properties : node.elements; if (entities.length === 0) { return; } if (_this._ignoreSingleValue && entities.length === 1) { return; } if (_this._ignoreSingleLine && node.loc.start.line === node.loc.end.line) { return; } var closingToken = file.getLastNodeToken(node); errors.assert.tokenBefore({ token: closingToken, expectedTokenBefore: {type: 'Punctuator', value: ','}, message: 'Missing comma before closing ' + (isLikeObject ? 'curly brace' : 'bracket') }); }); } |
| Function (anonymous_1182) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(node) { var isLikeObject = node.type === 'ObjectExpression' || node.type === 'ObjectPattern'; var entities = isLikeObject ? node.properties : node.elements; if (entities.length === 0) { return; } if (_this._ignoreSingleValue && entities.length === 1) { return; } if (_this._ignoreSingleLine && node.loc.start.line === node.loc.end.line) { return; } var closingToken = file.getLastNodeToken(node); errors.assert.tokenBefore({ token: closingToken, expectedTokenBefore: {type: 'Punctuator', value: ','}, message: 'Missing comma before closing ' + (isLikeObject ? 'curly brace' : 'bracket') }); }); |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires an extra comma following the final element of an arnode.type === 'ObjectPattern'; |
| ✓ Was returned | /**··· * Requires an extra comma node.type === 'ObjectExpression' || node.type === 'ObjectPattern'; |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | /**··· * Requires an extra comma following tnode.properties : node.elements; |
| ✓ Negative was returned (: ...) | /**··· * Requires an extra comma following the final element onode.elements; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires an extra comma followin{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir if (_this._ignoreSingleValue && entities.length === 1) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires an extra comma following the final element of an ar{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir if (_this._ignoreSingleLine && node.loc.start.line === node.loc.end.line) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires an extra comma following theentities.length === 1) { |
| ✓ Was returned | /**··· * Requires _this._ignoreSingleValue && entities.length === 1) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires an extra comma following the final element of an array or object liter{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir var closingToken = file.getLastNodeToken(node); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires an extra comma following thnode.loc.start.line === node.loc.end.line) { |
| ✓ Was returned | /**··· * Requires _this._ignoreSingleLine && node.loc.start.line === node.loc.end.line) { |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | /**··· * Requires an extra comma following the final element of an array or o'curly brace' : 'bracket') |
| ✓ Negative was returned (: ...) | /**··· * Requires an extra comma following the final element of an array or object literal. 'bracket') |
| Function getVariableScope | |
|---|---|
| ✓ Was called | function getVariableScope(node) {··· while (node.type !== 'Program' && node.type !== 'FunctionDeclaration' && node.type !== 'FunctionExpression') { node = node.parentNode; } return node; } |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Rnode.type !== 'FunctionExpression') { |
| ✓ Was returned | /**··· * Requnode.type !== 'Program' && node.type !== 'FunctionDeclaration' && |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Rnode.type !== 'FunctionDeclaration' && |
| ✓ Was returned | /**··· * Requnode.type !== 'Program' && |
| Function getOffsetForBlockStatement | |
|---|---|
| ✓ Was called | function getOffsetForBlockStatement(enclosingScope, varDecl, commentTokens, file) {··· var offset = 0; var parentNode = varDecl.parentNode; if (enclosingScope.type !== 'Program' && parentNode.type === 'BlockStatement') { offset += 1; offset += getCommentOffsetBetweenNodes(parentNode, varDecl, commentTokens, file); } return offset; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires `var` declaration to be on the top of an enclosing scope * * Type{ offset += 1; offset += getCommentOffsetBetweenNodes(parentNode, varDecl, commentTokens, file); } |
| ✓ Negative was executed (else) | /**··· return offset; |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires `var` declaration to be on thparentNode.type === 'BlockStatement') { |
| ✓ Was returned | /**··· * RenclosingScope.type !== 'Program' && parentNode.type === 'BlockStatement') { |
| Function getUseStrictDeclFirst | |
|---|---|
| ✓ Was called | function getUseStrictDeclFirst(enclosingScope) {··· var firstNode; if (enclosingScope.type === 'Program') { firstNode = enclosingScope.body[0]; } else { firstNode = enclosingScope.body.body[0]; } if (firstNode.type === 'ExpressionStatement' && firstNode.hasOwnProperty('expression') === true && firstNode.expression.hasOwnProperty('value') === true && firstNode.expression.value === 'use strict') { return firstNode; } return null; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires `var` declaration to be on { firstNode = enclosingScope.body[0]; } else { |
| ✓ Negative was executed (else) | /**··· * Requ{ firstNode = enclosingScope.body.body[0]; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires `var` declaration to be on the top of{ return firstNode; } |
| ✓ Negative was executed (else) | /**··· return null; |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * RfirstNode.expression.value === 'use strict') { |
| ✓ Was returned | /**··· * RfirstNode.type === 'ExpressionStatement' && firstNode.hasOwnProperty('expression') === true && firstNode.expression.hasOwnProperty('value') === true && |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * RfirstNode.expression.hasOwnProperty('value') === true && |
| ✓ Was returned | /**··· * RfirstNode.type === 'ExpressionStatement' && firstNode.hasOwnProperty('expression') === true && |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * RfirstNode.hasOwnProperty('expression') === true && |
| ✓ Was returned | /**··· * RfirstNode.type === 'ExpressionStatement' && |
| Function isFirstVarDeclInScope | |
|---|---|
| ✓ Was called | function isFirstVarDeclInScope(enclosingScope, varDecl, whitespaceOffsetBeforeVarDecl, commentTokens, file) {··· var adjustedVarDeclStart = varDecl.range[0]; var adjustedScopeStart = enclosingScope.range[0]; if (enclosingScope.type !== 'Program') { // For function declaration and function expression scope use the top block statement as start // This removes the requirement to offset the function declaration or expression related tokens adjustedScopeStart = enclosingScope.body.range[0]; // If enclosing scope node type is Program the range start ignores all comments and whitespace before the // variable declaration adjustedVarDeclStart -= whitespaceOffsetBeforeVarDecl; } adjustedVarDeclStart -= getOffsetForBlockStatement(enclosingScope, varDecl, commentTokens, file); if (adjustedVarDeclStart === adjustedScopeStart) { return true; } return false; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires `var` declaration to be on { // For function declaration and function expression scope use the top block statement as start // This removes the requirement to offset the function declaration or expression related tokens adjustedScopeStart = enclosingScope.body.range[0]; // If enclosing scope node type is Program the range start ignores all comments and whitespace before the // variable declaration adjustedVarDeclStart -= whitespaceOffsetBeforeVarDecl; } |
| ✓ Negative was executed (else) | /**··· adjustedVarDeclStart -= getOffsetForBlockStatement(enclosingScope, varDecl, commentTokens, file); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires `var` declaration to be on the top of{ return true; } |
| ✓ Negative was executed (else) | /**··· return false; |
| Function getCommentOffsetBetweenNodes | |
|---|---|
| ✓ Was called | function getCommentOffsetBetweenNodes(previousNode, currentNode, commentTokens, file) {··· var count; var comment; var commentLength = 0; for (count = 0; count < commentTokens.length; count++) { comment = commentTokens[count]; if (comment.range[0] >= currentNode.range[1]) { // Stop processing comments that are occurred after current node break; } if (previousNode.range[1] < currentNode.range[0] && comment.range[0] > previousNode.range[0] && comment.range[1] < previousNode.range[1]) { // Stop processing comments that are within multiple declarators in a single variable declaration // of the previous node and the previousNode is not the parent of currentNode break; } if (comment.range[0] > currentNode.range[0] && comment.range[1] < currentNode.range[1]) { // Stop processing comments that are within multiple declarators in a single variable declaration break; } if (previousNode.range[0] >= comment.range[1]) { // Skip comments that occurred before the previous node continue; } commentLength += comment.range[1] - comment.range[0] + file.getWhitespaceBefore(comment).length; } return commentLength; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires `var` declaration to be on the top of { // Stop processing comments that are occurred after current node break; } |
| ✓ Negative was executed (else) | /**··· * Re if (previousNode.range[1] < currentNode.range[0] && |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires `var` declaration to be on the top of { // Stop processing comments that are within multiple declarators in a single variable declaration // of the previous node and the previousNode is not the parent of currentNode break; } |
| ✓ Negative was executed (else) | /**··· * Re if (comment.range[0] > currentNode.range[0] && |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requicomment.range[1] < previousNode.range[1]) { |
| ✓ Was returned | /**··· * RequipreviousNode.range[1] < currentNode.range[0] && comment.range[0] > previousNode.range[0] && |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requicomment.range[0] > previousNode.range[0] && |
| ✓ Was returned | /**··· * RequipreviousNode.range[1] < currentNode.range[0] && |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires `var` declaration to be on the top of{ // Stop processing comments that are within multiple declarators in a single variable declaration break; } |
| ✓ Negative was executed (else) | /**··· * Re if (previousNode.range[0] >= comment.range[1]) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requicomment.range[1] < currentNode.range[1]) { |
| ✓ Was returned | /**··· * Requicomment.range[0] > currentNode.range[0] && |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires `var` declaration to be on the top of a{ // Skip comments that occurred before the previous node continue; } |
| ✓ Negative was executed (else) | /**··· * Re commentLength += comment.range[1] - comment.range[0] + file.getWhitespaceBefore(comment).length; |
| Function isPreviousNodeAVarDecl | |
|---|---|
| ✓ Was called | function isPreviousNodeAVarDecl(previousNode, varDecl, whitespaceOffsetBeforeVarDecl, commentTokens, file) {··· var offsetForComments; if (varDecl.range[0] === previousNode.range[1]) { return true; } offsetForComments = getCommentOffsetBetweenNodes(previousNode, varDecl, commentTokens, file); if (varDecl.range[0] - whitespaceOffsetBeforeVarDecl - offsetForComments === previousNode.range[1]) { return true; } return false; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires `var` declaration to be on the top o{ return true; } |
| ✓ Negative was executed (else) | /**··· offsetForComments = getCommentOffsetBetweenNodes(previousNode, varDecl, commentTokens, file); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires `var` declaration to be on the top of an enclosing scope * * Types: `Boolean` * * Va{ return true; } |
| ✓ Negative was executed (else) | /**··· return false; |
| Function (anonymous_1189) | |
|---|---|
| ✓ Was called | /**··· * Requires `function() {}; |
| Function (anonymous_1190) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(options) { assert( options === true, this.getOptionName() + ' option requires a true value' ); }, |
| Function (anonymous_1191) | |
|---|---|
| ✓ Was called | /**··· * Requires `vafunction() { return 'requireVarDeclFirst'; }, |
| Function (anonymous_1192) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var scopesFoundInFile = {}; var commentTokens = []; file.iterateTokensByType(['Line', 'Block'], function(commentToken) { commentTokens.push(commentToken); }); file.iterateNodesByType(['VariableDeclaration'], function(varDecl) { // Ignore let and const for now #1783 if (varDecl.kind !== 'var') { return; } var enclosingScope; var scopeContents; var previousNode; var useStrictDirective; var isVarDeclFirst = false; var whitespaceOffsetBeforeVarDecl = file.getWhitespaceBefore(file.getFirstNodeToken(varDecl)).length; enclosingScope = getVariableScope(varDecl.parentNode); if (!scopesFoundInFile.hasOwnProperty(enclosingScope.range[0])) { scopesFoundInFile[enclosingScope.range[0]] = { hasNonVarDecl: false, varDecl: [] }; // placing the handling 'use strict' declared as the first statement of scope here to improve // performance to run once per scope discovered in file useStrictDirective = getUseStrictDeclFirst(enclosingScope); if (useStrictDirective !== null) { // Special case to make varDecl stack contain the use strict as first node // this reduces the complexity of the isFirstVarDecInScope and reuses // isPreviousNodeAVarDecl to handle this special scenario scopesFoundInFile[enclosingScope.range[0]].varDecl.push(useStrictDirective); } } scopeContents = scopesFoundInFile[enclosingScope.range[0]]; if (scopeContents.varDecl.length === 0) { isVarDeclFirst = isFirstVarDeclInScope( enclosingScope, varDecl, whitespaceOffsetBeforeVarDecl, commentTokens, file ); } else { previousNode = scopeContents.varDecl[scopeContents.varDecl.length - 1]; if (!scopeContents.hasNonVarDecl) { isVarDeclFirst = isPreviousNodeAVarDecl( previousNode, varDecl, whitespaceOffsetBeforeVarDecl, commentTokens, file ); } } scopeContents.varDecl.push(varDecl); if (!isVarDeclFirst) { scopeContents.hasNonVarDecl = true; errors.add('Variable declarations must be the first statements of a function scope.', varDecl.loc.start.line, varDecl.loc.start.column); } }); } |
| Function (anonymous_1193) | |
|---|---|
| ✓ Was called | /**··· * Requires `var` declaration to be on the top ofunction(commentToken) { commentTokens.push(commentToken); }); |
| Function (anonymous_1194) | |
|---|---|
| ✓ Was called | /**··· * Requires `var` declaration to be on the top of an function(varDecl) { // Ignore let and const for now #1783 if (varDecl.kind !== 'var') { return; } var enclosingScope; var scopeContents; var previousNode; var useStrictDirective; var isVarDeclFirst = false; var whitespaceOffsetBeforeVarDecl = file.getWhitespaceBefore(file.getFirstNodeToken(varDecl)).length; enclosingScope = getVariableScope(varDecl.parentNode); if (!scopesFoundInFile.hasOwnProperty(enclosingScope.range[0])) { scopesFoundInFile[enclosingScope.range[0]] = { hasNonVarDecl: false, varDecl: [] }; // placing the handling 'use strict' declared as the first statement of scope here to improve // performance to run once per scope discovered in file useStrictDirective = getUseStrictDeclFirst(enclosingScope); if (useStrictDirective !== null) { // Special case to make varDecl stack contain the use strict as first node // this reduces the complexity of the isFirstVarDecInScope and reuses // isPreviousNodeAVarDecl to handle this special scenario scopesFoundInFile[enclosingScope.range[0]].varDecl.push(useStrictDirective); } } scopeContents = scopesFoundInFile[enclosingScope.range[0]]; if (scopeContents.varDecl.length === 0) { isVarDeclFirst = isFirstVarDeclInScope( enclosingScope, varDecl, whitespaceOffsetBeforeVarDecl, commentTokens, file ); } else { previousNode = scopeContents.varDecl[scopeContents.varDecl.length - 1]; if (!scopeContents.hasNonVarDecl) { isVarDeclFirst = isPreviousNodeAVarDecl( previousNode, varDecl, whitespaceOffsetBeforeVarDecl, commentTokens, file ); } } scopeContents.varDecl.push(varDecl); if (!isVarDeclFirst) { scopeContents.hasNonVarDecl = true; errors.add('Variable declarations must be the first statements of a function scope.', varDecl.loc.start.line, varDecl.loc.start.column); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires `var` declaration to be { return; } |
| ✓ Negative was executed (else) | /**··· * Requir var enclosingScope; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires `var` declaration to be on the top of an enclosing scope * { scopesFoundInFile[enclosingScope.range[0]] = { hasNonVarDecl: false, varDecl: [] }; // placing the handling 'use strict' declared as the first statement of scope here to improve // performance to run once per scope discovered in file useStrictDirective = getUseStrictDeclFirst(enclosingScope); if (useStrictDirective !== null) { // Special case to make varDecl stack contain the use strict as first node // this reduces the complexity of the isFirstVarDecInScope and reuses // isPreviousNodeAVarDecl to handle this special scenario scopesFoundInFile[enclosingScope.range[0]].varDecl.push(useStrictDirective); } } |
| ✓ Negative was executed (else) | /**··· * Requir scopeContents = scopesFoundInFile[enclosingScope.range[0]]; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires `var` declaration to be on the to{ // Special case to make varDecl stack contain the use strict as first node // this reduces the complexity of the isFirstVarDecInScope and reuses // isPreviousNodeAVarDecl to handle this special scenario scopesFoundInFile[enclosingScope.range[0]].varDecl.push(useStrictDirective); } |
| ✓ Negative was executed (else) | /**··· * Requires ` } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires `var` declaration to be on the top o{ isVarDeclFirst = isFirstVarDeclInScope( enclosingScope, varDecl, whitespaceOffsetBeforeVarDecl, commentTokens, file ); } else { |
| ✓ Negative was executed (else) | /**··· * Requires `va{ previousNode = scopeContents.varDecl[scopeContents.varDecl.length - 1]; if (!scopeContents.hasNonVarDecl) { isVarDeclFirst = isPreviousNodeAVarDecl( previousNode, varDecl, whitespaceOffsetBeforeVarDecl, commentTokens, file ); } } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires `var` declaration to be on the top{ isVarDeclFirst = isPreviousNodeAVarDecl( previousNode, varDecl, whitespaceOffsetBeforeVarDecl, commentTokens, file ); } |
| ✓ Negative was executed (else) | /**··· * Requires ` } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires `var` declaration{ scopeContents.hasNonVarDecl = true; errors.add('Variable declarations must be the first statements of a function scope.', varDecl.loc.start.line, varDecl.loc.start.column); } |
| ✓ Negative was executed (else) | /**··· * Requir }); |
| Function (anonymous_1195) | |
|---|---|
| ✓ Was called | /**··· * Requires tfunction() {}; |
| Function (anonymous_1196) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(operators) { var isTrue = operators === true; assert( Array.isArray(operators) || isTrue, this.getOptionName() + ' option requires array or true value' ); if (isTrue) { operators = ['==', '===', '!=', '!==']; } this._operatorIndex = {}; for (var i = 0, l = operators.length; i < l; i++) { this._operatorIndex[operators[i]] = true; } }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires the variable to be the risTrue, |
| ✓ Was returned | /**··· * RequiArray.isArray(operators) || isTrue, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires the { operators = ['==', '===', '!=', '!==']; } |
| ✓ Negative was executed (else) | /**··· * Re this._operatorIndex = {}; |
| Function (anonymous_1197) | |
|---|---|
| ✓ Was called | /**··· * Requires thefunction() { return 'requireYodaConditions'; }, |
| Function (anonymous_1198) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var operators = this._operatorIndex; file.iterateNodesByType('BinaryExpression', function(node) { if (operators[node.operator]) { if (node.right.type === 'Literal' || (node.right.type === 'Identifier' && node.right.name === 'undefined') ) { errors.add('Not yoda condition', node.left.loc.start); } } }); } |
| Function (anonymous_1199) | |
|---|---|
| ✓ Was called | /**··· * Requires the variable to be the right hand opfunction(node) { if (operators[node.operator]) { if (node.right.type === 'Literal' || (node.right.type === 'Identifier' && node.right.name === 'undefined') ) { errors.add('Not yoda condition', node.left.loc.start); } } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires the variable to be the rig{ if (node.right.type === 'Literal' || (node.right.type === 'Identifier' && node.right.name === 'undefined') ) { errors.add('Not yoda condition', node.left.loc.start); } } |
| ✓ Negative was executed (else) | /**··· * Requir }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires th{ errors.add('Not yoda condition', node.left.loc.start); } |
| ✓ Negative was executed (else) | /**··· * Requires t } |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires the vnode.right.type === 'Identifier' && node.right.name === 'undefined') |
| ✓ Was returned | /**··· * Requires the node.right.type === 'Literal' || |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires the variable to be the right hand operatonode.right.name === 'undefined') |
| ✓ Was returned | /**··· * Requires the vnode.right.type === 'Identifier' && node.right.name === 'undefined') |
| Function (anonymous_1200) | |
|---|---|
| ✓ Was called | /**··· * Option to function() {}; |
| Function (anonymous_1201) | |
|---|---|
| ✓ Was called | /**··· * Option tfunction(keywords) { assert( Array.isArray(keywords) || typeof keywords === 'string', this.getOptionName() + ' option requires string or array value' ); this._keywords = keywords; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Option to check `var that = thistypeof keywords === 'string', |
| ✓ Was returned | /**··· * OptioArray.isArray(keywords) || typeof keywords === 'string', |
| Function (anonymous_1202) | |
|---|---|
| ✓ Was called | /**··· * Option to chfunction() { return 'safeContextKeyword'; }, |
| Function (anonymous_1203) | |
|---|---|
| ✓ Was called | /**··· * Optifunction(file, errors) { var keywords = typeof this._keywords === 'string' ? [this._keywords] : this._keywords; // var that = this file.iterateNodesByType('VariableDeclaration', function(node) { var firstToken = file.getFirstNodeToken(node); // Miss destructing assignment (#1699) if (file.getNextToken(firstToken).value === '{') { return; } for (var i = 0; i < node.declarations.length; i++) { var decl = node.declarations[i]; // decl.init === null in case of "var foo;" if (decl.init && (decl.init.type === 'ThisExpression' && checkKeywords(decl.id.name, keywords)) ) { errors.add( 'You should use "' + keywords.join('" or "') + '" to save a reference to "this"', node.loc.start ); } } }); // that = this file.iterateNodesByType('AssignmentExpression', function(node) { if ( // filter property assignments "foo.bar = this" node.left.type === 'Identifier' && (node.right.type === 'ThisExpression' && checkKeywords(node.left.name, keywords)) ) { errors.add( 'You should use "' + keywords.join('" or "') + '" to save a reference to "this"', node.loc.start ); } }); } |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | /**··· * Option to check `var that = this` expressions * * T[this._keywords] : this._keywords; |
| ✓ Negative was returned (: ...) | /**··· * Option to check `var that = this` expressions * * Types: `String`, `Arthis._keywords; |
| Function (anonymous_1204) | |
|---|---|
| ✓ Was called | /**··· * Option to check `var that = this` expressions *function(node) { var firstToken = file.getFirstNodeToken(node); // Miss destructing assignment (#1699) if (file.getNextToken(firstToken).value === '{') { return; } for (var i = 0; i < node.declarations.length; i++) { var decl = node.declarations[i]; // decl.init === null in case of "var foo;" if (decl.init && (decl.init.type === 'ThisExpression' && checkKeywords(decl.id.name, keywords)) ) { errors.add( 'You should use "' + keywords.join('" or "') + '" to save a reference to "this"', node.loc.start ); } } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Option to check `var that = this` expressions * * Ty{ return; } |
| ✓ Negative was executed (else) | /**··· * Option for (var i = 0; i < node.declarations.length; i++) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Option to c{ errors.add( 'You should use "' + keywords.join('" or "') + '" to save a reference to "this"', node.loc.start ); } |
| ✓ Negative was executed (else) | /**··· * Option to } |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Option to checdecl.init.type === 'ThisExpression' && checkKeywords(decl.id.name, keywords)) |
| ✓ Was returned | /**··· * Option to chedecl.init && |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Option to check `var that = this` expressions * * TcheckKeywords(decl.id.name, keywords)) |
| ✓ Was returned | /**··· * Option to checdecl.init.type === 'ThisExpression' && checkKeywords(decl.id.name, keywords)) |
| Function (anonymous_1205) | |
|---|---|
| ✓ Was called | /**··· * Option to check `var that = this` expressions * function(node) { if ( // filter property assignments "foo.bar = this" node.left.type === 'Identifier' && (node.right.type === 'ThisExpression' && checkKeywords(node.left.name, keywords)) ) { errors.add( 'You should use "' + keywords.join('" or "') + '" to save a reference to "this"', node.loc.start ); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Option { errors.add( 'You should use "' + keywords.join('" or "') + '" to save a reference to "this"', node.loc.start ); } |
| ✓ Negative was executed (else) | /**··· * Option }); |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Option to node.right.type === 'ThisExpression' && checkKeywords(node.left.name, keywords)) |
| ✓ Was returned | /**··· * Option tonode.left.type === 'Identifier' && |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Option to check `var that = this` expressions * checkKeywords(node.left.name, keywords)) |
| ✓ Was returned | /**··· * Option to node.right.type === 'ThisExpression' && checkKeywords(node.left.name, keywords)) |
| Function checkKeywords | |
|---|---|
| ✓ Was called | function checkKeywords(name, keywords) {··· for (var i = 0; i < keywords.length; i++) { if (name === keywords[i]) { return false; } } return true; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Option to check `var that ={ return false; } |
| ✓ Negative was executed (else) | /**··· * Op } |
| Function (anonymous_1207) | |
|---|---|
| ✓ Was called | /**··· * Validates function() {}; |
| Function (anonymous_1208) | |
|---|---|
| ✓ Was called | /**··· * Validatefunction(options) { var validProperties = [ 'lineBreakAfterOpeningBrace', 'lineBreakBeforeClosingBrace' ]; var optionName = this.getOptionName(); assert( typeof options === 'object' || options === true, optionName + ' option must be an object or boolean true' ); if (typeof options === 'object') { validProperties.forEach(function(key) { var isPresent = key in options; if (isPresent) { assert( options[key] === true, optionName + '.' + key + ' property requires true value or should be removed' ); } }); validProperties.forEach(function(property) { this['_' + property] = Boolean(options[property]); }.bind(this)); } }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Validates proper alignment of functioptions === true, |
| ✓ Was returned | /**··· * Validtypeof options === 'object' || options === true, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates proper alignment of func{ validProperties.forEach(function(key) { var isPresent = key in options; if (isPresent) { assert( options[key] === true, optionName + '.' + key + ' property requires true value or should be removed' ); } }); validProperties.forEach(function(property) { this['_' + property] = Boolean(options[property]); }.bind(this)); } |
| ✓ Negative was executed (else) | /**··· * Va }, |
| Function (anonymous_1209) | |
|---|---|
| ✓ Was called | /**··· * Validates proper alignment offunction(key) { var isPresent = key in options; if (isPresent) { assert( options[key] === true, optionName + '.' + key + ' property requires true value or should be removed' ); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates proper alignme{ assert( options[key] === true, optionName + '.' + key + ' property requires true value or should be removed' ); } |
| ✓ Negative was executed (else) | /**··· * Validates }); |
| Function (anonymous_1210) | |
|---|---|
| ✓ Was called | /**··· * Validates proper alignment offunction(property) { this['_' + property] = Boolean(options[property]); }.bind(this)); |
| Function (anonymous_1211) | |
|---|---|
| ✓ Was called | /**··· * Validates prfunction() { return 'validateAlignedFunctionParameters'; }, |
| Function (anonymous_1212) | |
|---|---|
| ✓ Was called | /**··· * Valifunction(file, errors) { var lineBreakAfterOpeningBrace = this._lineBreakAfterOpeningBrace; var lineBreakBeforeClosingBrace = this._lineBreakBeforeClosingBrace; file.iterateNodesByType([ 'FunctionDeclaration', 'FunctionExpression', 'ArrowFunctionExpression' ], function(node) { // ignore this rule if there are no parameters if (node.params.length === 0) { return; } // ignore this rule if the parameters are not multi-line var firstParameter = file.getFirstNodeToken(node.params[0]); var lastParameter = node.params[node.params.length - 1]; if (firstParameter.loc.start.line === lastParameter.loc.end.line) { return; } // look for the furthest parameter start position var maxParamStartPos = 0; node.params.forEach(function(parameter) { maxParamStartPos = Math.max(maxParamStartPos, parameter.loc.start.column); }); // make sure all parameters are lined up node.params.forEach(function(parameter) { if (parameter.loc.start.column !== maxParamStartPos) { errors.add('Multi-line parameters are not aligned.', parameter.loc.start); } }); // make sure the first parameter is on a new line if (lineBreakAfterOpeningBrace) { var openingBrace = file.getPrevToken(firstParameter); errors.assert.differentLine({ token: openingBrace, nextToken: firstParameter, message: 'There is no line break after the opening brace' }); } // make sure the closing brace is on a new line if (lineBreakBeforeClosingBrace) { var bodyToken = file.getFirstNodeToken(node.body); var closingBrace = file.getPrevToken(bodyToken); errors.assert.differentLine({ token: lastParameter, nextToken: closingBrace, message: 'There is no line break before the closing brace' }); } }); } |
| Function (anonymous_1213) | |
|---|---|
| ✓ Was called | /**··· * Valifunction(node) { // ignore this rule if there are no parameters if (node.params.length === 0) { return; } // ignore this rule if the parameters are not multi-line var firstParameter = file.getFirstNodeToken(node.params[0]); var lastParameter = node.params[node.params.length - 1]; if (firstParameter.loc.start.line === lastParameter.loc.end.line) { return; } // look for the furthest parameter start position var maxParamStartPos = 0; node.params.forEach(function(parameter) { maxParamStartPos = Math.max(maxParamStartPos, parameter.loc.start.column); }); // make sure all parameters are lined up node.params.forEach(function(parameter) { if (parameter.loc.start.column !== maxParamStartPos) { errors.add('Multi-line parameters are not aligned.', parameter.loc.start); } }); // make sure the first parameter is on a new line if (lineBreakAfterOpeningBrace) { var openingBrace = file.getPrevToken(firstParameter); errors.assert.differentLine({ token: openingBrace, nextToken: firstParameter, message: 'There is no line break after the opening brace' }); } // make sure the closing brace is on a new line if (lineBreakBeforeClosingBrace) { var bodyToken = file.getFirstNodeToken(node.body); var closingBrace = file.getPrevToken(bodyToken); errors.assert.differentLine({ token: lastParameter, nextToken: closingBrace, message: 'There is no line break before the closing brace' }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates proper alignment of funct{ return; } |
| ✓ Negative was executed (else) | /**··· * Valida // ignore this rule if the parameters are not multi-line |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates proper alignment of function parameters. * * Types: `Boolea{ return; } |
| ✓ Negative was executed (else) | /**··· * Valida // look for the furthest parameter start position |
| Function (anonymous_1214) | |
|---|---|
| ✓ Was called | /**··· * Validates proper alignmenfunction(parameter) { maxParamStartPos = Math.max(maxParamStartPos, parameter.loc.start.column); }); |
| Function (anonymous_1215) | |
|---|---|
| ✓ Was called | /**··· * Validates proper alignmenfunction(parameter) { if (parameter.loc.start.column !== maxParamStartPos) { errors.add('Multi-line parameters are not aligned.', parameter.loc.start); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates proper alignment of function parameters. * * Types{ errors.add('Multi-line parameters are not aligned.', parameter.loc.start); } |
| ✓ Negative was executed (else) | /**··· * Validates }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates proper alignment of functio{ var openingBrace = file.getPrevToken(firstParameter); errors.assert.differentLine({ token: openingBrace, nextToken: firstParameter, message: 'There is no line break after the opening brace' }); } |
| ✓ Negative was executed (else) | /**··· * Valida // make sure the closing brace is on a new line |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates proper alignment of function{ var bodyToken = file.getFirstNodeToken(node.body); var closingBrace = file.getPrevToken(bodyToken); errors.assert.differentLine({ token: lastParameter, nextToken: closingBrace, message: 'There is no line break before the closing brace' }); } |
| ✓ Negative was executed (else) | /**··· * Valida }); |
| Function (anonymous_1216) | |
|---|---|
| ✓ Was called | /**··· * This rule function() {}; |
| Function (anonymous_1217) | |
|---|---|
| ✓ Was called | /**··· * This rulfunction(options) { var validPositions = { 'above': 'above', 'beside': 'beside' }; var allExcept = options.allExcept; assert( typeof options === 'object' && validPositions[options.position], this.getOptionName() + ' requires one of the following values: ' + Object.keys(validPositions).join(', ') ); if (Array.isArray(allExcept)) { assert( allExcept.every(function(el) { return typeof el === 'string'; }), 'Property `allExcept` in ' + allExcept + ' should be an array of strings' ); this._isExcepted = isPragma(allExcept); } else { this._isExcepted = isPragma(); } this._position = options.position; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * This rule is for validating the posivalidPositions[options.position], |
| ✓ Was returned | /**··· * This typeof options === 'object' && validPositions[options.position], |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * This rule is for validating the{ assert( allExcept.every(function(el) { return typeof el === 'string'; }), 'Property `allExcept` in ' + allExcept + ' should be an array of strings' ); this._isExcepted = isPragma(allExcept); } else { |
| ✓ Negative was executed (else) | /**··· * This rul{ this._isExcepted = isPragma(); } |
| Function (anonymous_1218) | |
|---|---|
| ✓ Was called | /**··· * This rule is for validatifunction(el) { return typeof el === 'string'; }), |
| Function (anonymous_1219) | |
|---|---|
| ✓ Was called | /**··· * This rule isfunction() { return 'validateCommentPosition'; }, |
| Function (anonymous_1220) | |
|---|---|
| ✓ Was called | /**··· * Thisfunction(file, errors) { var position = this._position; var isExcepted = this._isExcepted; file.iterateTokensByType('Line', function(comment) { if (isExcepted(comment.value)) { return; } var firstToken = file.getFirstTokenOnLine(comment.loc.start.line, { includeComments: true }); if (position === 'above' && !firstToken.isComment) { errors.add('Expected comments to be above the code not beside', comment.loc.start); } if (position === 'beside' && firstToken.isComment) { errors.add('Expected comments to be beside the code not above', comment.loc.start); } }); } |
| Function (anonymous_1221) | |
|---|---|
| ✓ Was called | /**··· * This rule is for validating the pofunction(comment) { if (isExcepted(comment.value)) { return; } var firstToken = file.getFirstTokenOnLine(comment.loc.start.line, { includeComments: true }); if (position === 'above' && !firstToken.isComment) { errors.add('Expected comments to be above the code not beside', comment.loc.start); } if (position === 'beside' && firstToken.isComment) { errors.add('Expected comments to be beside the code not above', comment.loc.start); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * This rule is for validating the posi{ return; } |
| ✓ Negative was executed (else) | /**··· * This r var firstToken = file.getFirstTokenOnLine(comment.loc.start.line, { includeComments: true }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * This rule is for validating the positioning of line comm{ errors.add('Expected comments to be above the code not beside', comment.loc.start); } |
| ✓ Negative was executed (else) | /**··· * This r if (position === 'beside' && firstToken.isComment) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * This rule is for validating the p!firstToken.isComment) { |
| ✓ Was returned | /**··· * This ruleposition === 'above' && !firstToken.isComment) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * This rule is for validating the positioning of line comm{ errors.add('Expected comments to be beside the code not above', comment.loc.start); } |
| ✓ Negative was executed (else) | /**··· * This r }); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * This rule is for validating the pofirstToken.isComment) { |
| ✓ Was returned | /**··· * This ruleposition === 'beside' && firstToken.isComment) { |
| Function (anonymous_1222) | |
|---|---|
| ✓ Was called | /**··· * Validates function() {}; |
| Function (anonymous_1223) | |
|---|---|
| ✓ Was called | /**··· * Validatefunction(options) { this._includeEmptyLines = false; this._exceptComments = false; if (typeof options === 'object') { this._includeEmptyLines = (options.includeEmptyLines === true); if (Array.isArray(options.allExcept)) { this._exceptComments = options.allExcept.indexOf('comments') > -1; this._includeEmptyLines = options.allExcept.indexOf('emptyLines') > -1; } options = options.value; } assert( options === '\t' || (typeof options === 'number' && options > 0), this.getOptionName() + ' option requires a positive number of spaces or "\\t"' + ' or options object with "value" property' ); if (typeof options === 'number') { this._indentChar = ' '; this._indentSize = options; } else { this._indentChar = '\t'; this._indentSize = 1; } this._breakIndents = null; this._moduleIndents = null; }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates indentation for switch s{ this._includeEmptyLines = (options.includeEmptyLines === true); if (Array.isArray(options.allExcept)) { this._exceptComments = options.allExcept.indexOf('comments') > -1; this._includeEmptyLines = options.allExcept.indexOf('emptyLines') > -1; } options = options.value; } |
| ✓ Negative was executed (else) | /**··· * Va assert( |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates indentation for switch statements{ this._exceptComments = options.allExcept.indexOf('comments') > -1; this._includeEmptyLines = options.allExcept.indexOf('emptyLines') > -1; } |
| ✓ Negative was executed (else) | /**··· * Valida options = options.value; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Validates typeof options === 'number' && options > 0), |
| ✓ Was returned | /**··· * Validoptions === '\t' || |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Validates indentation for switch statemenoptions > 0), |
| ✓ Was returned | /**··· * Validates typeof options === 'number' && options > 0), |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates indentation for switch s{ this._indentChar = ' '; this._indentSize = options; } else { |
| ✓ Negative was executed (else) | /**··· * Validate{ this._indentChar = '\t'; this._indentSize = 1; } |
| Function (anonymous_1224) | |
|---|---|
| ✓ Was called | /**··· * Validates infunction() { return 'validateIndentation'; }, |
| Function (anonymous_1225) | |
|---|---|
| ✓ Was called | /**··· * Valifunction(file, errors) { function markCheckLine(line) { linesToCheck[line].check = true; } function markCheck(node) { markCheckLine(node.loc.start.line - 1); } function markEndCheck(node) { markCheckLine(node.loc.end.line - 1); } function markPush(node, indents) { linesToCheck[node.loc.start.line - 1].push.push(indents); } function markPop(node, outdents) { linesToCheck[node.loc.end.line - 1].pop.push(outdents); } function markPushAlt(node) { linesToCheck[node.loc.start.line - 1].pushAltLine.push(node.loc.end.line - 1); } function markCase(caseNode, children) { var outdentNode = getCaseOutdent(children); if (outdentNode) { // If a case statement has a `break` as a direct child and it is the // first one encountered, use it as the example for all future case indentation if (_this._breakIndents === null) { _this._breakIndents = (caseNode.loc.start.column === outdentNode.loc.start.column) ? 1 : 0; } markPop(outdentNode, _this._breakIndents); } else { markPop(caseNode, 0); } } function markChildren(node) { getChildren(node).forEach(function(childNode) { if (childNode.loc.start.line !== node.loc.start.line) { markCheck(childNode); } }); } function markKeyword(node) { if (node) { markCheck(file.getPrevToken(file.getFirstNodeToken(node))); } } function isMultiline(node) { return node.loc.start.line !== node.loc.end.line; } function getCaseOutdent(caseChildren) { var outdentNode; caseChildren.some(function(node) { if (node.type === 'BreakStatement') { outdentNode = node; return true; } }); return outdentNode; } function getBlockNodeToPush(node) { var parent = node.parentNode; // The parent of an else is the entire if/else block. To avoid over indenting // in the case of a non-block if with a block else, mark push where the else starts, // not where the if starts! if (parent.type === 'IfStatement' && parent.alternate === node) { return node; } // The end line to check of a do while statement needs to be the location of the // closing curly brace, not the while statement, to avoid marking the last line of // a multiline while as a line to check. if (parent.type === 'DoWhileStatement') { return node; } // Detect bare blocks: a block whose parent doesn't expect blocks in its syntax specifically. if (blockParents.indexOf(parent.type) === -1) { return node; } return parent; } function getChildren(node) { var childrenProperty = indentableNodes[node.type]; return node[childrenProperty]; } function getIndentationFromLine(line) { var firstContent = line.search(rNotIndentChar); if (firstContent === -1) { firstContent = line.length; } return firstContent; } function checkIndentations() { var lineAugment = 0; linesToCheck.forEach(function(line, i) { var lineNumber = i + 1; var actualIndentation = line.indentation; var expectedIndentation = getExpectedIndentation(line, actualIndentation); // do not augment this line considering this line changes indentation if (line.pop.length || line.push.length) { lineAugment = 0; } if (line.check) { errors.assert.indentation({ lineNumber: lineNumber, actual: actualIndentation, expected: expectedIndentation, indentChar: indentChar }); // for multiline statements, we need move subsequent lines over the correct // number of spaces to match the change made to the first line of the statement. lineAugment = expectedIndentation - actualIndentation; // correct the indentation so that future lines can be validated appropriately actualIndentation = expectedIndentation; } else if (!line.empty) { // in the case that we moved a previous line over a certain number spaces, // we need to move this line over as well, but technically, it's not an error errors.assert.indentation({ lineNumber: lineNumber, actual: actualIndentation, // Avoid going negative in the case that a previous line was overindented, // and now outdenting a line that is already at column zero. expected: Math.max(actualIndentation + lineAugment, 0), indentChar: indentChar, silent: true }); } if (line.push.length) { pushExpectedIndentations(line, actualIndentation); } }); } function getExpectedIndentation(line, actual) { var outdent = indentSize * Math.max.apply(null, line.pop); var idx = indentStack.length - 1; var expected = indentStack[idx]; if (!Array.isArray(expected)) { expected = [expected]; } expected = expected.map(function(value) { if (line.pop.length) { value -= outdent; } return value; }).reduce(function(previous, current) { // when the expected is an array, resolve the value // back into a Number by checking both values are the actual indentation return actual === current ? current : previous; }); indentStack[idx] = expected; line.pop.forEach(function() { indentStack.pop(); }); return expected; } function pushExpectedIndentations(line, actualIndentation) { var indents = Math.max.apply(null, line.push); var expected = actualIndentation + (indentSize * indents); // when a line has alternate indentations, push an array of possible values // on the stack, to be resolved when checked against an actual indentation if (line.pushAltLine.length) { expected = [expected]; line.pushAltLine.forEach(function(altLine) { expected.push(linesToCheck[altLine].indentation + (indentSize * indents)); }); } line.push.forEach(function() { indentStack.push(expected); }); } function setModuleBody(node) { if (node.body.length !== 1 || node.body[0].type !== 'ExpressionStatement' || node.body[0].expression.type !== 'CallExpression') { return; } var callExpression = node.body[0].expression; var callee = callExpression.callee; var callArgs = callExpression.arguments; var iffeFunction = utils.getFunctionNodeFromIIFE(callExpression); if (iffeFunction) { if (callArgs.length === 1 && callArgs[0].type === 'FunctionExpression') { // detect UMD Shim, where the file body is the body of the factory, // which is the sole argument to the IIFE moduleBody = callArgs[0].body; } else { // full file IIFE moduleBody = iffeFunction.body; } } // detect require/define if (callee.type === 'Identifier' && callee.name.match(/^(require|define)$/)) { // the define callback is the *first* functionExpression encountered, // as it can be the first, second, or third argument. callArgs.some(function(argument) { if (argument.type === 'FunctionExpression') { moduleBody = argument.body; return true; } }); } // set number of indents for modules by detecting // whether the first statement is indented or not if (moduleBody && moduleBody.body.length) { _this._moduleIndents = moduleBody.body[0].loc.start.column > 0 ? 1 : 0; } } function generateIndentations() { file.iterateNodesByType('Program', function(node) { if (!isMultiline(node)) { return; } setModuleBody(node); markChildren(node); }); file.iterateNodesByType('BlockStatement', function(node) { if (!isMultiline(node)) { return; } var indents = node === moduleBody ? _this._moduleIndents : 1; markChildren(node); markPop(node, indents); markPush(getBlockNodeToPush(node), indents); markEndCheck(node); }); file.iterateNodesByType('ObjectExpression', function(node) { if (!isMultiline(node)) { return; } var children = getChildren(node); // only check objects that have children and that look like they are trying to adhere // to an indentation strategy, i.e. objects that have curly braces on their own lines. if (!children.length || node.loc.start.line === children[0].loc.start.line || node.loc.end.line === children[children.length - 1].loc.end.line) { return; } markChildren(node); markPop(node, 1); markPush(node, 1); markEndCheck(node); markPushAlt(node); }); file.iterateNodesByType('IfStatement', function(node) { markKeyword(node.alternate); }); file.iterateNodesByType('TryStatement', function(node) { if (!isMultiline(node)) { return; } var handler = node.handlers && node.handlers.length ? node.handlers[0] : node.handler; if (handler) { markCheck(handler); } markKeyword(node.finalizer); }); file.iterateNodesByType('SwitchStatement', function(node) { if (!isMultiline(node)) { return; } var indents = 1; var children = getChildren(node); if (children.length < 1) { return; } if (node.loc.start.column === children[0].loc.start.column) { indents = 0; } markChildren(node); markPop(node, indents); markPush(node, indents); markEndCheck(node); }); file.iterateNodesByType('SwitchCase', function(node) { if (!isMultiline(node)) { return; } var children = getChildren(node); if (children.length === 1 && children[0].type === 'BlockStatement') { return; } markPush(node, 1); markCheck(node); markChildren(node); markCase(node, children); }); // indentations inside of function expressions can be offset from // either the start of the function or the end of the function, therefore // mark all starting lines of functions as potential indentations file.iterateNodesByType(['FunctionDeclaration', 'FunctionExpression'], function(node) { markPushAlt(node); }); if (_this._includeEmptyLines) { linesToCheck.forEach(function(line) { if (line.empty) { line.check = true; } }); } if (!_this._exceptComments) { // starting from the bottom, which allows back to back comments to be checked, mark comments file.getComments().concat().reverse().forEach(function(node) { var startLine = node.loc.start.line; var firstToken = file.getFirstTokenOnLine(startLine, { includeComments: true }); var nextToken = file.getNextToken(firstToken, { includeComments: true }); var nextStartLine = nextToken.loc.start.line; var nextLine = linesToCheck[nextStartLine - 1]; // ignore if not the only token on the line, or not right above another checked line if (firstToken !== node || startLine === nextStartLine || !nextLine.check) { return; } // ignore if next line is a case statement, which is kind of hacky, but avoids // additional complexity for what qualifies as an outdent if (nextToken && nextToken.type === 'Keyword' && (nextToken.value === 'case' || nextToken.value === 'default')) { return; } // ignore if above a line that both introduces and ends an ident, // which catches cases like a comment above an `else if`, but not nested ifs. if (nextLine.push.length && nextLine.pop.length) { return; } markCheck(node); }); } } var _this = this; var moduleBody; var indentChar = this._indentChar; var indentSize = this._indentSize; var rNotIndentChar = new RegExp('[^' + indentChar + ']'); var indentStack = [0]; var linesToCheck = file.getLines().map(function(line) { return { push: [], pushAltLine: [], pop: [], check: false, indentation: getIndentationFromLine(line), empty: line.match(/^\s*$/) }; }); generateIndentations(); checkIndentations(); } |
| Function markCheckLine | |
|---|---|
| ✓ Was called | /**··· * Vfunction markCheckLine(line) { linesToCheck[line].check = true; } |
| Function markCheck | |
|---|---|
| ✓ Was called | /**··· * Vfunction markCheck(node) { markCheckLine(node.loc.start.line - 1); } |
| Function markEndCheck | |
|---|---|
| ✓ Was called | /**··· * Vfunction markEndCheck(node) { markCheckLine(node.loc.end.line - 1); } |
| Function markPush | |
|---|---|
| ✓ Was called | /**··· * Vfunction markPush(node, indents) { linesToCheck[node.loc.start.line - 1].push.push(indents); } |
| Function markPop | |
|---|---|
| ✓ Was called | /**··· * Vfunction markPop(node, outdents) { linesToCheck[node.loc.end.line - 1].pop.push(outdents); } |
| Function markPushAlt | |
|---|---|
| ✓ Was called | /**··· * Vfunction markPushAlt(node) { linesToCheck[node.loc.start.line - 1].pushAltLine.push(node.loc.end.line - 1); } |
| Function markCase | |
|---|---|
| ✓ Was called | /**··· * Vfunction markCase(caseNode, children) { var outdentNode = getCaseOutdent(children); if (outdentNode) { // If a case statement has a `break` as a direct child and it is the // first one encountered, use it as the example for all future case indentation if (_this._breakIndents === null) { _this._breakIndents = (caseNode.loc.start.column === outdentNode.loc.start.column) ? 1 : 0; } markPop(outdentNode, _this._breakIndents); } else { markPop(caseNode, 0); } } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates indentation { // If a case statement has a `break` as a direct child and it is the // first one encountered, use it as the example for all future case indentation if (_this._breakIndents === null) { _this._breakIndents = (caseNode.loc.start.column === outdentNode.loc.start.column) ? 1 : 0; } markPop(outdentNode, _this._breakIndents); } else { |
| ✓ Negative was executed (else) | /**··· * Validates in{ markPop(caseNode, 0); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates indentation for switch statements{ _this._breakIndents = (caseNode.loc.start.column === outdentNode.loc.start.column) ? 1 : 0; } |
| ✓ Negative was executed (else) | /**··· * Validates markPop(outdentNode, _this._breakIndents); |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | /**··· * Validates indentation for switch statements and block statements * * Types: `Integer`, `String` 1 : 0; |
| ✓ Negative was returned (: ...) | /**··· * Validates indentation for switch statements and block statements * * Types: `Integer`, `String` or `0; |
| Function markChildren | |
|---|---|
| ✓ Was called | /**··· * Vfunction markChildren(node) { getChildren(node).forEach(function(childNode) { if (childNode.loc.start.line !== node.loc.start.line) { markCheck(childNode); } }); } |
| Function (anonymous_1234) | |
|---|---|
| ✓ Was called | /**··· * Validates indentation for switcfunction(childNode) { if (childNode.loc.start.line !== node.loc.start.line) { markCheck(childNode); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates indentation for switch statements and block statement{ markCheck(childNode); } |
| ✓ Negative was executed (else) | /**··· * Validates }); |
| Function markKeyword | |
|---|---|
| ✓ Was called | /**··· * Vfunction markKeyword(node) { if (node) { markCheck(file.getPrevToken(file.getFirstNodeToken(node))); } } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates inden{ markCheck(file.getPrevToken(file.getFirstNodeToken(node))); } |
| ✓ Negative was executed (else) | /**··· * Valida } |
| Function isMultiline | |
|---|---|
| ✓ Was called | /**··· * Vfunction isMultiline(node) { return node.loc.start.line !== node.loc.end.line; } |
| Function getCaseOutdent | |
|---|---|
| ✓ Was called | /**··· * Vfunction getCaseOutdent(caseChildren) { var outdentNode; caseChildren.some(function(node) { if (node.type === 'BreakStatement') { outdentNode = node; return true; } }); return outdentNode; } |
| Function (anonymous_1238) | |
|---|---|
| ✓ Was called | /**··· * Validates indentation ffunction(node) { if (node.type === 'BreakStatement') { outdentNode = node; return true; } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates indentation for switch statements a{ outdentNode = node; return true; } |
| ✓ Negative was executed (else) | /**··· * Validates }); |
| Function getBlockNodeToPush | |
|---|---|
| ✓ Was called | /**··· * Vfunction getBlockNodeToPush(node) { var parent = node.parentNode; // The parent of an else is the entire if/else block. To avoid over indenting // in the case of a non-block if with a block else, mark push where the else starts, // not where the if starts! if (parent.type === 'IfStatement' && parent.alternate === node) { return node; } // The end line to check of a do while statement needs to be the location of the // closing curly brace, not the while statement, to avoid marking the last line of // a multiline while as a line to check. if (parent.type === 'DoWhileStatement') { return node; } // Detect bare blocks: a block whose parent doesn't expect blocks in its syntax specifically. if (blockParents.indexOf(parent.type) === -1) { return node; } return parent; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates indentation for switch statements and block statements * { return node; } |
| ✓ Negative was executed (else) | /**··· * Valida // The end line to check of a do while statement needs to be the location of the |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Validates indentation for switch statementparent.alternate === node) { |
| ✓ Was returned | /**··· * Validatesparent.type === 'IfStatement' && parent.alternate === node) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates indentation for switch statements a{ return node; } |
| ✓ Negative was executed (else) | /**··· * Valida // Detect bare blocks: a block whose parent doesn't expect blocks in its syntax specifically. |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates indentation for switch statements and blo{ return node; } |
| ✓ Negative was executed (else) | /**··· * Valida return parent; |
| Function getChildren | |
|---|---|
| ✓ Was called | /**··· * Vfunction getChildren(node) { var childrenProperty = indentableNodes[node.type]; return node[childrenProperty]; } |
| Function getIndentationFromLine | |
|---|---|
| ✓ Was called | /**··· * Vfunction getIndentationFromLine(line) { var firstContent = line.search(rNotIndentChar); if (firstContent === -1) { firstContent = line.length; } return firstContent; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates indentation for swit{ firstContent = line.length; } |
| ✓ Negative was executed (else) | /**··· * Valida return firstContent; |
| Function checkIndentations | |
|---|---|
| ✓ Was called | /**··· * Vfunction checkIndentations() { var lineAugment = 0; linesToCheck.forEach(function(line, i) { var lineNumber = i + 1; var actualIndentation = line.indentation; var expectedIndentation = getExpectedIndentation(line, actualIndentation); // do not augment this line considering this line changes indentation if (line.pop.length || line.push.length) { lineAugment = 0; } if (line.check) { errors.assert.indentation({ lineNumber: lineNumber, actual: actualIndentation, expected: expectedIndentation, indentChar: indentChar }); // for multiline statements, we need move subsequent lines over the correct // number of spaces to match the change made to the first line of the statement. lineAugment = expectedIndentation - actualIndentation; // correct the indentation so that future lines can be validated appropriately actualIndentation = expectedIndentation; } else if (!line.empty) { // in the case that we moved a previous line over a certain number spaces, // we need to move this line over as well, but technically, it's not an error errors.assert.indentation({ lineNumber: lineNumber, actual: actualIndentation, // Avoid going negative in the case that a previous line was overindented, // and now outdenting a line that is already at column zero. expected: Math.max(actualIndentation + lineAugment, 0), indentChar: indentChar, silent: true }); } if (line.push.length) { pushExpectedIndentations(line, actualIndentation); } }); } |
| Function (anonymous_1243) | |
|---|---|
| ✓ Was called | /**··· * Validates indentation for function(line, i) { var lineNumber = i + 1; var actualIndentation = line.indentation; var expectedIndentation = getExpectedIndentation(line, actualIndentation); // do not augment this line considering this line changes indentation if (line.pop.length || line.push.length) { lineAugment = 0; } if (line.check) { errors.assert.indentation({ lineNumber: lineNumber, actual: actualIndentation, expected: expectedIndentation, indentChar: indentChar }); // for multiline statements, we need move subsequent lines over the correct // number of spaces to match the change made to the first line of the statement. lineAugment = expectedIndentation - actualIndentation; // correct the indentation so that future lines can be validated appropriately actualIndentation = expectedIndentation; } else if (!line.empty) { // in the case that we moved a previous line over a certain number spaces, // we need to move this line over as well, but technically, it's not an error errors.assert.indentation({ lineNumber: lineNumber, actual: actualIndentation, // Avoid going negative in the case that a previous line was overindented, // and now outdenting a line that is already at column zero. expected: Math.max(actualIndentation + lineAugment, 0), indentChar: indentChar, silent: true }); } if (line.push.length) { pushExpectedIndentations(line, actualIndentation); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates indentation for switch statements and bl{ lineAugment = 0; } |
| ✓ Negative was executed (else) | /**··· * Validates if (line.check) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Validates indentation for switchline.push.length) { |
| ✓ Was returned | /**··· * Validates indline.pop.length || line.push.length) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates indentation for{ errors.assert.indentation({ lineNumber: lineNumber, actual: actualIndentation, expected: expectedIndentation, indentChar: indentChar }); // for multiline statements, we need move subsequent lines over the correct // number of spaces to match the change made to the first line of the statement. lineAugment = expectedIndentation - actualIndentation; // correct the indentation so that future lines can be validated appropriately actualIndentation = expectedIndentation; } else if (!line.empty) { |
| ✓ Negative was executed (else) | /**··· * Validates indentif (!line.empty) { // in the case that we moved a previous line over a certain number spaces, // we need to move this line over as well, but technically, it's not an error errors.assert.indentation({ lineNumber: lineNumber, actual: actualIndentation, // Avoid going negative in the case that a previous line was overindented, // and now outdenting a line that is already at column zero. expected: Math.max(actualIndentation + lineAugment, 0), indentChar: indentChar, silent: true }); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates indentation for switch { // in the case that we moved a previous line over a certain number spaces, // we need to move this line over as well, but technically, it's not an error errors.assert.indentation({ lineNumber: lineNumber, actual: actualIndentation, // Avoid going negative in the case that a previous line was overindented, // and now outdenting a line that is already at column zero. expected: Math.max(actualIndentation + lineAugment, 0), indentChar: indentChar, silent: true }); } |
| ✓ Negative was executed (else) | /**··· * Validates if (line.push.length) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates indentation for switc{ pushExpectedIndentations(line, actualIndentation); } |
| ✓ Negative was executed (else) | /**··· * Validates }); |
| Function getExpectedIndentation | |
|---|---|
| ✓ Was called | /**··· * Vfunction getExpectedIndentation(line, actual) { var outdent = indentSize * Math.max.apply(null, line.pop); var idx = indentStack.length - 1; var expected = indentStack[idx]; if (!Array.isArray(expected)) { expected = [expected]; } expected = expected.map(function(value) { if (line.pop.length) { value -= outdent; } return value; }).reduce(function(previous, current) { // when the expected is an array, resolve the value // back into a Number by checking both values are the actual indentation return actual === current ? current : previous; }); indentStack[idx] = expected; line.pop.forEach(function() { indentStack.pop(); }); return expected; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates indentation for switch st{ expected = [expected]; } |
| ✓ Negative was executed (else) | /**··· * Valida expected = expected.map(function(value) { |
| Function (anonymous_1245) | |
|---|---|
| ✓ Was called | /**··· * Validates indentation for swifunction(value) { if (line.pop.length) { value -= outdent; } return value; }).reduce(function(previous, current) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates indentation for swit{ value -= outdent; } |
| ✓ Negative was executed (else) | /**··· * Validates return value; |
| Function (anonymous_1246) | |
|---|---|
| ✓ Was called | /**··· * Validates indenfunction(previous, current) { // when the expected is an array, resolve the value // back into a Number by checking both values are the actual indentation return actual === current ? current : previous; }); |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | /**··· * Validates indentation for switch statcurrent : previous; |
| ✓ Negative was returned (: ...) | /**··· * Validates indentation for switch statements andprevious; |
| Function (anonymous_1247) | |
|---|---|
| ✓ Was called | /**··· * Validates indentation function() { indentStack.pop(); }); |
| Function pushExpectedIndentations | |
|---|---|
| ✓ Was called | /**··· * Vfunction pushExpectedIndentations(line, actualIndentation) { var indents = Math.max.apply(null, line.push); var expected = actualIndentation + (indentSize * indents); // when a line has alternate indentations, push an array of possible values // on the stack, to be resolved when checked against an actual indentation if (line.pushAltLine.length) { expected = [expected]; line.pushAltLine.forEach(function(altLine) { expected.push(linesToCheck[altLine].indentation + (indentSize * indents)); }); } line.push.forEach(function() { indentStack.push(expected); }); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates indentation for switch s{ expected = [expected]; line.pushAltLine.forEach(function(altLine) { expected.push(linesToCheck[altLine].indentation + (indentSize * indents)); }); } |
| ✓ Negative was executed (else) | /**··· * Valida line.push.forEach(function() { |
| Function (anonymous_1249) | |
|---|---|
| ✓ Was called | /**··· * Validates indentation for switch sfunction(altLine) { expected.push(linesToCheck[altLine].indentation + (indentSize * indents)); }); |
| Function (anonymous_1250) | |
|---|---|
| ✓ Was called | /**··· * Validates indentation ffunction() { indentStack.push(expected); }); |
| Function setModuleBody | |
|---|---|
| ✓ Was called | /**··· * Vfunction setModuleBody(node) { if (node.body.length !== 1 || node.body[0].type !== 'ExpressionStatement' || node.body[0].expression.type !== 'CallExpression') { return; } var callExpression = node.body[0].expression; var callee = callExpression.callee; var callArgs = callExpression.arguments; var iffeFunction = utils.getFunctionNodeFromIIFE(callExpression); if (iffeFunction) { if (callArgs.length === 1 && callArgs[0].type === 'FunctionExpression') { // detect UMD Shim, where the file body is the body of the factory, // which is the sole argument to the IIFE moduleBody = callArgs[0].body; } else { // full file IIFE moduleBody = iffeFunction.body; } } // detect require/define if (callee.type === 'Identifier' && callee.name.match(/^(require|define)$/)) { // the define callback is the *first* functionExpression encountered, // as it can be the first, second, or third argument. callArgs.some(function(argument) { if (argument.type === 'FunctionExpression') { moduleBody = argument.body; return true; } }); } // set number of indents for modules by detecting // whether the first statement is indented or not if (moduleBody && moduleBody.body.length) { _this._moduleIndents = moduleBody.body[0].loc.start.column > 0 ? 1 : 0; } } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates indentation for switch statements and block statem{ return; } |
| ✓ Negative was executed (else) | /**··· * Valida var callExpression = node.body[0].expression; |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Validatesnode.body[0].expression.type !== 'CallExpression') { |
| ✓ Was returned | /**··· * Validatesnode.body.length !== 1 || node.body[0].type !== 'ExpressionStatement' || |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Validates indentation for switch stnode.body[0].type !== 'ExpressionStatement' || |
| ✓ Was returned | /**··· * Validatesnode.body.length !== 1 || node.body[0].type !== 'ExpressionStatement' || |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates indentation f{ if (callArgs.length === 1 && callArgs[0].type === 'FunctionExpression') { // detect UMD Shim, where the file body is the body of the factory, // which is the sole argument to the IIFE moduleBody = callArgs[0].body; } else { // full file IIFE moduleBody = iffeFunction.body; } } |
| ✓ Negative was executed (else) | /**··· * Valida // detect require/define |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates indentation for switch statements and block statements * * Types: `In{ // detect UMD Shim, where the file body is the body of the factory, // which is the sole argument to the IIFE moduleBody = callArgs[0].body; } else { |
| ✓ Negative was executed (else) | /**··· * Validates indent{ // full file IIFE moduleBody = iffeFunction.body; } |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Validates indentation for switch statecallArgs[0].type === 'FunctionExpression') { |
| ✗ Was not returned | /**··· * Validates indcallArgs.length === 1 && callArgs[0].type === 'FunctionExpression') { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates indentation for switch statements and block statements * * Types: `Int{ // the define callback is the *first* functionExpression encountered, // as it can be the first, second, or third argument. callArgs.some(function(argument) { if (argument.type === 'FunctionExpression') { moduleBody = argument.body; return true; } }); } |
| ✓ Negative was executed (else) | /**··· * Valida // set number of indents for modules by detecting |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Validates indentation for switch statemencallee.name.match(/^(require|define)$/)) { |
| ✓ Was returned | /**··· * Validatescallee.type === 'Identifier' && callee.name.match(/^(require|define)$/)) { |
| Function (anonymous_1252) | |
|---|---|
| ✓ Was called | /**··· * Validates indentation ffunction(argument) { if (argument.type === 'FunctionExpression') { moduleBody = argument.body; return true; } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates indentation for switch statements and block sta{ moduleBody = argument.body; return true; } |
| ✓ Negative was executed (else) | /**··· * Validates inde }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates indentation for switch statements and{ _this._moduleIndents = moduleBody.body[0].loc.start.column > 0 ? 1 : 0; } |
| ✓ Negative was executed (else) | /**··· * Valida } |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Validates indentation fmoduleBody.body.length) { |
| ✓ Was returned | /**··· * ValidatesmoduleBody && moduleBody.body.length) { |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | /**··· * Validates indentation for switch statements and block statements * * Typ1 : 0; |
| ✓ Negative was returned (: ...) | /**··· * Validates indentation for switch statements and block statements * * Types: 0; |
| Function generateIndentations | |
|---|---|
| ✓ Was called | /**··· * Vfunction generateIndentations() { file.iterateNodesByType('Program', function(node) { if (!isMultiline(node)) { return; } setModuleBody(node); markChildren(node); }); file.iterateNodesByType('BlockStatement', function(node) { if (!isMultiline(node)) { return; } var indents = node === moduleBody ? _this._moduleIndents : 1; markChildren(node); markPop(node, indents); markPush(getBlockNodeToPush(node), indents); markEndCheck(node); }); file.iterateNodesByType('ObjectExpression', function(node) { if (!isMultiline(node)) { return; } var children = getChildren(node); // only check objects that have children and that look like they are trying to adhere // to an indentation strategy, i.e. objects that have curly braces on their own lines. if (!children.length || node.loc.start.line === children[0].loc.start.line || node.loc.end.line === children[children.length - 1].loc.end.line) { return; } markChildren(node); markPop(node, 1); markPush(node, 1); markEndCheck(node); markPushAlt(node); }); file.iterateNodesByType('IfStatement', function(node) { markKeyword(node.alternate); }); file.iterateNodesByType('TryStatement', function(node) { if (!isMultiline(node)) { return; } var handler = node.handlers && node.handlers.length ? node.handlers[0] : node.handler; if (handler) { markCheck(handler); } markKeyword(node.finalizer); }); file.iterateNodesByType('SwitchStatement', function(node) { if (!isMultiline(node)) { return; } var indents = 1; var children = getChildren(node); if (children.length < 1) { return; } if (node.loc.start.column === children[0].loc.start.column) { indents = 0; } markChildren(node); markPop(node, indents); markPush(node, indents); markEndCheck(node); }); file.iterateNodesByType('SwitchCase', function(node) { if (!isMultiline(node)) { return; } var children = getChildren(node); if (children.length === 1 && children[0].type === 'BlockStatement') { return; } markPush(node, 1); markCheck(node); markChildren(node); markCase(node, children); }); // indentations inside of function expressions can be offset from // either the start of the function or the end of the function, therefore // mark all starting lines of functions as potential indentations file.iterateNodesByType(['FunctionDeclaration', 'FunctionExpression'], function(node) { markPushAlt(node); }); if (_this._includeEmptyLines) { linesToCheck.forEach(function(line) { if (line.empty) { line.check = true; } }); } if (!_this._exceptComments) { // starting from the bottom, which allows back to back comments to be checked, mark comments file.getComments().concat().reverse().forEach(function(node) { var startLine = node.loc.start.line; var firstToken = file.getFirstTokenOnLine(startLine, { includeComments: true }); var nextToken = file.getNextToken(firstToken, { includeComments: true }); var nextStartLine = nextToken.loc.start.line; var nextLine = linesToCheck[nextStartLine - 1]; // ignore if not the only token on the line, or not right above another checked line if (firstToken !== node || startLine === nextStartLine || !nextLine.check) { return; } // ignore if next line is a case statement, which is kind of hacky, but avoids // additional complexity for what qualifies as an outdent if (nextToken && nextToken.type === 'Keyword' && (nextToken.value === 'case' || nextToken.value === 'default')) { return; } // ignore if above a line that both introduces and ends an ident, // which catches cases like a comment above an `else if`, but not nested ifs. if (nextLine.push.length && nextLine.pop.length) { return; } markCheck(node); }); } } |
| Function (anonymous_1254) | |
|---|---|
| ✓ Was called | /**··· * Validates indentation for switch statemefunction(node) { if (!isMultiline(node)) { return; } setModuleBody(node); markChildren(node); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates indentation for switch { return; } |
| ✓ Negative was executed (else) | /**··· * Validates setModuleBody(node); |
| Function (anonymous_1255) | |
|---|---|
| ✓ Was called | /**··· * Validates indentation for switch statements andfunction(node) { if (!isMultiline(node)) { return; } var indents = node === moduleBody ? _this._moduleIndents : 1; markChildren(node); markPop(node, indents); markPush(getBlockNodeToPush(node), indents); markEndCheck(node); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates indentation for switch { return; } |
| ✓ Negative was executed (else) | /**··· * Validates var indents = node === moduleBody ? _this._moduleIndents : 1; |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | /**··· * Validates indentation for switch statements a_this._moduleIndents : 1; |
| ✓ Negative was returned (: ...) | /**··· * Validates indentation for switch statements and block statements * 1; |
| Function (anonymous_1256) | |
|---|---|
| ✓ Was called | /**··· * Validates indentation for switch statements and bfunction(node) { if (!isMultiline(node)) { return; } var children = getChildren(node); // only check objects that have children and that look like they are trying to adhere // to an indentation strategy, i.e. objects that have curly braces on their own lines. if (!children.length || node.loc.start.line === children[0].loc.start.line || node.loc.end.line === children[children.length - 1].loc.end.line) { return; } markChildren(node); markPop(node, 1); markPush(node, 1); markEndCheck(node); markPushAlt(node); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates indentation for switch { return; } |
| ✓ Negative was executed (else) | /**··· * Validates var children = getChildren(node); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates indentation for switch statements and block statements * * Types: `{ return; } |
| ✓ Negative was executed (else) | /**··· * Validates markChildren(node); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Validates indnode.loc.end.line === children[children.length - 1].loc.end.line) { |
| ✓ Was returned | /**··· * Validates ind!children.length || node.loc.start.line === children[0].loc.start.line || |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Validates indentation for switch node.loc.start.line === children[0].loc.start.line || |
| ✗ Was not returned | /**··· * Validates ind!children.length || node.loc.start.line === children[0].loc.start.line || |
| Function (anonymous_1257) | |
|---|---|
| ✓ Was called | /**··· * Validates indentation for switch statements function(node) { markKeyword(node.alternate); }); |
| Function (anonymous_1258) | |
|---|---|
| ✓ Was called | /**··· * Validates indentation for switch statements afunction(node) { if (!isMultiline(node)) { return; } var handler = node.handlers && node.handlers.length ? node.handlers[0] : node.handler; if (handler) { markCheck(handler); } markKeyword(node.finalizer); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates indentation for switch { return; } |
| ✓ Negative was executed (else) | /**··· * Validates var handler = node.handlers && node.handlers.length ? node.handlers[0] : node.handler; |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | /**··· * Validates indentation for switch statements and block statementnode.handlers[0] : node.handler; |
| ✓ Negative was returned (: ...) | /**··· * Validates indentation for switch statements and block statements * * Types: `Intnode.handler; |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Validates indentation for switch statemenode.handlers.length ? node.handlers[0] : node.handler; |
| ✗ Was not returned | /**··· * Validates indentation fnode.handlers && node.handlers.length ? node.handlers[0] : node.handler; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates indentation { markCheck(handler); } |
| ✓ Negative was executed (else) | /**··· * Validates markKeyword(node.finalizer); |
| Function (anonymous_1259) | |
|---|---|
| ✓ Was called | /**··· * Validates indentation for switch statements and function(node) { if (!isMultiline(node)) { return; } var indents = 1; var children = getChildren(node); if (children.length < 1) { return; } if (node.loc.start.column === children[0].loc.start.column) { indents = 0; } markChildren(node); markPop(node, indents); markPush(node, indents); markEndCheck(node); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates indentation for switch { return; } |
| ✓ Negative was executed (else) | /**··· * Validates var indents = 1; |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates indentation for switch s{ return; } |
| ✓ Negative was executed (else) | /**··· * Validates if (node.loc.start.column === children[0].loc.start.column) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates indentation for switch statements and block statements * { indents = 0; } |
| ✓ Negative was executed (else) | /**··· * Validates markChildren(node); |
| Function (anonymous_1260) | |
|---|---|
| ✓ Was called | /**··· * Validates indentation for switch statementsfunction(node) { if (!isMultiline(node)) { return; } var children = getChildren(node); if (children.length === 1 && children[0].type === 'BlockStatement') { return; } markPush(node, 1); markCheck(node); markChildren(node); markCase(node, children); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates indentation for switch { return; } |
| ✓ Negative was executed (else) | /**··· * Validates var children = getChildren(node); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates indentation for switch statements and block statements * * Types:{ return; } |
| ✓ Negative was executed (else) | /**··· * Validates markPush(node, 1); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Validates indentation for switch statechildren[0].type === 'BlockStatement') { |
| ✓ Was returned | /**··· * Validates indchildren.length === 1 && children[0].type === 'BlockStatement') { |
| Function (anonymous_1261) | |
|---|---|
| ✓ Was called | /**··· * Validates indentation for switch statements and block statements * * Typesfunction(node) { markPushAlt(node); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates indentation for switch st{ linesToCheck.forEach(function(line) { if (line.empty) { line.check = true; } }); } |
| ✓ Negative was executed (else) | /**··· * Valida if (!_this._exceptComments) { |
| Function (anonymous_1262) | |
|---|---|
| ✓ Was called | /**··· * Validates indentation for switfunction(line) { if (line.empty) { line.check = true; } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates indentation for swi{ line.check = true; } |
| ✓ Negative was executed (else) | /**··· * Validates inde }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates indentation for switch { // starting from the bottom, which allows back to back comments to be checked, mark comments file.getComments().concat().reverse().forEach(function(node) { var startLine = node.loc.start.line; var firstToken = file.getFirstTokenOnLine(startLine, { includeComments: true }); var nextToken = file.getNextToken(firstToken, { includeComments: true }); var nextStartLine = nextToken.loc.start.line; var nextLine = linesToCheck[nextStartLine - 1]; // ignore if not the only token on the line, or not right above another checked line if (firstToken !== node || startLine === nextStartLine || !nextLine.check) { return; } // ignore if next line is a case statement, which is kind of hacky, but avoids // additional complexity for what qualifies as an outdent if (nextToken && nextToken.type === 'Keyword' && (nextToken.value === 'case' || nextToken.value === 'default')) { return; } // ignore if above a line that both introduces and ends an ident, // which catches cases like a comment above an `else if`, but not nested ifs. if (nextLine.push.length && nextLine.pop.length) { return; } markCheck(node); }); } |
| ✓ Negative was executed (else) | /**··· * Valida } |
| Function (anonymous_1263) | |
|---|---|
| ✓ Was called | /**··· * Validates indentation for switch statements and block sfunction(node) { var startLine = node.loc.start.line; var firstToken = file.getFirstTokenOnLine(startLine, { includeComments: true }); var nextToken = file.getNextToken(firstToken, { includeComments: true }); var nextStartLine = nextToken.loc.start.line; var nextLine = linesToCheck[nextStartLine - 1]; // ignore if not the only token on the line, or not right above another checked line if (firstToken !== node || startLine === nextStartLine || !nextLine.check) { return; } // ignore if next line is a case statement, which is kind of hacky, but avoids // additional complexity for what qualifies as an outdent if (nextToken && nextToken.type === 'Keyword' && (nextToken.value === 'case' || nextToken.value === 'default')) { return; } // ignore if above a line that both introduces and ends an ident, // which catches cases like a comment above an `else if`, but not nested ifs. if (nextLine.push.length && nextLine.pop.length) { return; } markCheck(node); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates indentation for switch statements and block statements * * Types: `Integer`,{ return; } |
| ✓ Negative was executed (else) | /**··· * Validates inde // ignore if next line is a case statement, which is kind of hacky, but avoids |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Validates indentation for switch statements and block statements * * !nextLine.check) { |
| ✓ Was returned | /**··· * Validates indentafirstToken !== node || startLine === nextStartLine || !nextLine.check) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Validates indentation for switch statemestartLine === nextStartLine || !nextLine.check) { |
| ✓ Was returned | /**··· * Validates indentafirstToken !== node || startLine === nextStartLine || !nextLine.check) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates indentation for switch statements and block statements * * Types: { return; } |
| ✓ Negative was executed (else) | /**··· * Validates inde // ignore if above a line that both introduces and ends an ident, |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Validates indentnextToken.value === 'case' || nextToken.value === 'default')) { |
| ✓ Was returned | /**··· * Validates indentanextToken && nextToken.type === 'Keyword' && |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Validates indentation for switnextToken.type === 'Keyword' && |
| ✗ Was not returned | /**··· * Validates indentanextToken && nextToken.type === 'Keyword' && |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Validates indentation for switch statements annextToken.value === 'default')) { |
| ✓ Was returned | /**··· * Validates indentnextToken.value === 'case' || nextToken.value === 'default')) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Validates indentation for switch statements and block statemen{ return; } |
| ✓ Negative was executed (else) | /**··· * Validates inde markCheck(node); |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Validates indentation for switch statemennextLine.pop.length) { |
| ✓ Was returned | /**··· * Validates indentanextLine.push.length && nextLine.pop.length) { |
| Function (anonymous_1264) | |
|---|---|
| ✓ Was called | /**··· * Validates indentation for switch statemefunction(line) { return { push: [], pushAltLine: [], pop: [], check: false, indentation: getIndentationFromLine(line), empty: line.match(/^\s*$/) }; }); |
| Function (anonymous_1265) | |
|---|---|
| ✓ Was called | /**··· * Option to function() {}; |
| Function (anonymous_1266) | |
|---|---|
| ✓ Was called | /**··· * Option tfunction(options) { assert( typeof options === 'string' || typeof options === 'object', this.getOptionName() + ' option requires string or object value' ); if (typeof options === 'string') { options = { character: options }; } var lineBreaks = { CR: '\r', LF: '\n', CRLF: '\r\n' }; this._allowedLineBreak = lineBreaks[options.character]; this._reportOncePerFile = options.reportOncePerFile !== false; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Option to check line break charactertypeof options === 'object', |
| ✓ Was returned | /**··· * Optiotypeof options === 'string' || typeof options === 'object', |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Option to check line break charact{ options = { character: options }; } |
| ✓ Negative was executed (else) | /**··· * Op var lineBreaks = { |
| Function (anonymous_1267) | |
|---|---|
| ✓ Was called | /**··· * Option to chfunction() { return 'validateLineBreaks'; }, |
| Function (anonymous_1268) | |
|---|---|
| ✓ Was called | /**··· * Optifunction(file, errors) { var lines = file.getLines(); if (lines.length < 2) { return; } file.getLineBreaks().some(function(lineBreak, i) { if (lineBreak !== this._allowedLineBreak) { errors.add('Invalid line break', i + 1, lines[i].length); return this._reportOncePerFile; } }, this); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Option to check line br{ return; } |
| ✓ Negative was executed (else) | /**··· * Op file.getLineBreaks().some(function(lineBreak, i) { |
| Function (anonymous_1269) | |
|---|---|
| ✓ Was called | /**··· * Option to check line break function(lineBreak, i) { if (lineBreak !== this._allowedLineBreak) { errors.add('Invalid line break', i + 1, lines[i].length); return this._reportOncePerFile; } }, this); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Option to check line break characters * * Typ{ errors.add('Invalid line break', i + 1, lines[i].length); return this._reportOncePerFile; } |
| ✓ Negative was executed (else) | /**··· * Option }, this); |
| Function (anonymous_1270) | |
|---|---|
| ✓ Was called | /**··· * Requires efunction() {}; |
| Function (anonymous_1271) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(opts) { assert( opts === true || typeof opts === 'number' && opts >= 1 || typeof opts === 'object', this.getOptionName() + ' option requires maximal number of items ' + 'or true value either should be removed' ); if (typeof opts === 'object') { this._options = { maximum: Infinity, ignoreBrackets: false }; if ('maximum' in opts) { assert(typeof opts.maximum === 'number' && opts.maximum >= 1, 'maximum property requires a positive number or should be removed'); this._options.maximum = opts.maximum; } if ('ignoreBrackets' in opts) { assert(opts.ignoreBrackets === true, 'ignoreBrackets property requires true value or should be removed'); this._options.ignoreBrackets = true; } } else { this._options = { maximum: opts === true ? Infinity : opts, ignoreBrackets: false }; } }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requitypeof opts === 'object', |
| ✓ Was returned | /**··· * Requiopts === true || typeof opts === 'number' && opts >= 1 || |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requitypeof opts === 'number' && opts >= 1 || |
| ✓ Was returned | /**··· * Requiopts === true || |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires each element in array onopts >= 1 || |
| ✓ Was returned | /**··· * Requitypeof opts === 'number' && opts >= 1 || |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires each element in array { this._options = { maximum: Infinity, ignoreBrackets: false }; if ('maximum' in opts) { assert(typeof opts.maximum === 'number' && opts.maximum >= 1, 'maximum property requires a positive number or should be removed'); this._options.maximum = opts.maximum; } if ('ignoreBrackets' in opts) { assert(opts.ignoreBrackets === true, 'ignoreBrackets property requires true value or should be removed'); this._options.ignoreBrackets = true; } } else { |
| ✓ Negative was executed (else) | /**··· * Requires{ this._options = { maximum: opts === true ? Infinity : opts, ignoreBrackets: false }; } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires each element in arr{ assert(typeof opts.maximum === 'number' && opts.maximum >= 1, 'maximum property requires a positive number or should be removed'); this._options.maximum = opts.maximum; } |
| ✓ Negative was executed (else) | /**··· * Requir if ('ignoreBrackets' in opts) { |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires each element in array on a single line whenopts.maximum >= 1, |
| ✓ Was returned | /**··· * Requires each eltypeof opts.maximum === 'number' && opts.maximum >= 1, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires each element in array on a{ assert(opts.ignoreBrackets === true, 'ignoreBrackets property requires true value or should be removed'); this._options.ignoreBrackets = true; } |
| ✓ Negative was executed (else) | /**··· * Requir } else { |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | /**··· * Requires each element in array on Infinity : opts, |
| ✓ Negative was returned (: ...) | /**··· * Requires each element in array on a single liopts, |
| Function (anonymous_1272) | |
|---|---|
| ✓ Was called | /**··· * Requires eacfunction() { return 'validateNewlineAfterArrayElements'; }, |
| Function (anonymous_1273) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var maximum = this._options.maximum; var ignoreBrackets = this._options.ignoreBrackets; file.iterateNodesByType(['ArrayExpression'], function(node) { var els = node.elements; var firstEl = els[0]; var lastEl = els[els.length - 1]; var bracket; var elToken; if (els.length <= maximum && node.loc.start.line === node.loc.end.line) { return; } if (!ignoreBrackets) { if (firstEl && firstEl.loc.start.line === node.loc.start.line) { bracket = file.getFirstNodeToken(node); elToken = file.getNextToken(bracket); errors.assert.differentLine({ token: bracket, nextToken: elToken, message: 'First element should be placed on new line' }); } if (lastEl && lastEl.loc.end.line === node.loc.end.line) { bracket = file.getLastNodeToken(node); elToken = file.getPrevToken(bracket); errors.assert.differentLine({ token: elToken, nextToken: bracket, message: 'Closing bracket should be placed on new line' }); } } els.forEach(function(elem) { var elToken; var comma; if (!elem) { // skip holes return; } if (firstEl !== elem) { elToken = file.getFirstNodeToken(elem); comma = file.getPrevToken(elToken); errors.assert.differentLine({ token: comma, nextToken: elToken, message: 'Multiple elements at a single line in multiline array' }); } }); }); } |
| Function (anonymous_1274) | |
|---|---|
| ✓ Was called | /**··· * Requires each element in array on a single linfunction(node) { var els = node.elements; var firstEl = els[0]; var lastEl = els[els.length - 1]; var bracket; var elToken; if (els.length <= maximum && node.loc.start.line === node.loc.end.line) { return; } if (!ignoreBrackets) { if (firstEl && firstEl.loc.start.line === node.loc.start.line) { bracket = file.getFirstNodeToken(node); elToken = file.getNextToken(bracket); errors.assert.differentLine({ token: bracket, nextToken: elToken, message: 'First element should be placed on new line' }); } if (lastEl && lastEl.loc.end.line === node.loc.end.line) { bracket = file.getLastNodeToken(node); elToken = file.getPrevToken(bracket); errors.assert.differentLine({ token: elToken, nextToken: bracket, message: 'Closing bracket should be placed on new line' }); } } els.forEach(function(elem) { var elToken; var comma; if (!elem) { // skip holes return; } if (firstEl !== elem) { elToken = file.getFirstNodeToken(elem); comma = file.getPrevToken(elToken); errors.assert.differentLine({ token: comma, nextToken: elToken, message: 'Multiple elements at a single line in multiline array' }); } }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires each element in array on a single line when array length is more tha{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir if (!ignoreBrackets) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires each element in array on node.loc.start.line === node.loc.end.line) { |
| ✓ Was returned | /**··· * Requires els.length <= maximum && node.loc.start.line === node.loc.end.line) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires each element in a{ if (firstEl && firstEl.loc.start.line === node.loc.start.line) { bracket = file.getFirstNodeToken(node); elToken = file.getNextToken(bracket); errors.assert.differentLine({ token: bracket, nextToken: elToken, message: 'First element should be placed on new line' }); } if (lastEl && lastEl.loc.end.line === node.loc.end.line) { bracket = file.getLastNodeToken(node); elToken = file.getPrevToken(bracket); errors.assert.differentLine({ token: elToken, nextToken: bracket, message: 'Closing bracket should be placed on new line' }); } } |
| ✓ Negative was executed (else) | /**··· * Requir els.forEach(function(elem) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires each element in array on a single line when array length is mor{ bracket = file.getFirstNodeToken(node); elToken = file.getNextToken(bracket); errors.assert.differentLine({ token: bracket, nextToken: elToken, message: 'First element should be placed on new line' }); } |
| ✓ Negative was executed (else) | /**··· * Requires e if (lastEl && lastEl.loc.end.line === node.loc.end.line) { |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires each element infirstEl.loc.start.line === node.loc.start.line) { |
| ✓ Was returned | /**··· * Requires eachfirstEl && firstEl.loc.start.line === node.loc.start.line) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires each element in array on a single line when array length { bracket = file.getLastNodeToken(node); elToken = file.getPrevToken(bracket); errors.assert.differentLine({ token: elToken, nextToken: bracket, message: 'Closing bracket should be placed on new line' }); } |
| ✓ Negative was executed (else) | /**··· * Requires e } |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires each element ilastEl.loc.end.line === node.loc.end.line) { |
| ✓ Was returned | /**··· * Requires eachlastEl && lastEl.loc.end.line === node.loc.end.line) { |
| Function (anonymous_1275) | |
|---|---|
| ✓ Was called | /**··· * Requires each elefunction(elem) { var elToken; var comma; if (!elem) { // skip holes return; } if (firstEl !== elem) { elToken = file.getFirstNodeToken(elem); comma = file.getPrevToken(elToken); errors.assert.differentLine({ token: comma, nextToken: elToken, message: 'Multiple elements at a single line in multiline array' }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires each elemen{ // skip holes return; } |
| ✓ Negative was executed (else) | /**··· * Requires e if (firstEl !== elem) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires each element in array { elToken = file.getFirstNodeToken(elem); comma = file.getPrevToken(elToken); errors.assert.differentLine({ token: comma, nextToken: elToken, message: 'Multiple elements at a single line in multiline array' }); } |
| ✓ Negative was executed (else) | /**··· * Requires e }); |
| Function asc | |
|---|---|
| ✓ Was called | function asc(a, b) {··· return String(a) < String(b) ? -1 : 1; } |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | ··· /** * Validates the order in obje-1 : 1; |
| ✓ Negative was returned (: ...) | ··· /** * Validates the order in object ke1; |
| Function ascInsensitive | |
|---|---|
| ✓ Was called | function ascInsensitive(a, b) {··· var lowercaseA = String(a).toLowerCase(); var lowercaseB = String(b).toLowerCase(); if (lowercaseA < lowercaseB) { return -1; } if (lowercaseA > lowercaseB) { return 1; } return asc(a, b); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | ··· /** * Validates the order in ob{ return -1; } |
| ✓ Negative was executed (else) | ··· /** if (lowercaseA > lowercaseB) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | ··· /** * Validates the order in ob{ return 1; } |
| ✓ Negative was executed (else) | ··· /** return asc(a, b); |
| Function ascNatural | |
|---|---|
| ✓ Was called | function ascNatural(a, b) {··· return naturalSort(a, b); } |
| Function desc | |
|---|---|
| ✓ Was called | function desc(a, b) {··· return asc(a, b) * -1; } |
| Function descInsensitive | |
|---|---|
| ✓ Was called | function descInsensitive(a, b) {··· return ascInsensitive(a, b) * -1; } |
| Function descNatural | |
|---|---|
| ✓ Was called | function descNatural(a, b) {··· return naturalSort(a, b) * -1; } |
| Function (anonymous_1282) | |
|---|---|
| ✓ Was called | ··· /** * Validatesfunction() {}; |
| Function (anonymous_1283) | |
|---|---|
| ✓ Was called | ··· /** * Validatfunction(options) { assert( options === true || Object.keys(methods).indexOf(options) !== -1, this.getOptionName() + ' option requires a true value or should be removed' ); this._sort = methods[options] || methods.asc; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | ··· /** * Validates the order in oObject.keys(methods).indexOf(options) !== -1, |
| ✗ Was not returned | ··· /** * Valioptions === true || Object.keys(methods).indexOf(options) !== -1, |
| Branch LogicalExpression | |
|---|---|
| ✗ Was not returned | ··· /** * Validates the order in object keymethods.asc; |
| ✓ Was returned | ··· /** * Validates themethods[options] || methods.asc; |
| Function (anonymous_1284) | |
|---|---|
| ✓ Was called | ··· /** * Validates tfunction() { return 'validateOrderInObjectKeys'; }, |
| Function (anonymous_1285) | |
|---|---|
| ✓ Was called | ··· /** * Valfunction(file, errors) { var sort = this._sort; file.iterateNodesByType('ObjectExpression', function(node) { var keys = node.properties.map(function(property) { return (property.key.name || property.key.value); }); var sorted = keys.slice(0).sort(sort); var unsorted; for (var i = 0; i < keys.length; i++) { if (keys[i] !== sorted[i]) { unsorted = i; break; } } if (undefined !== unsorted) { errors.add( 'Object keys must be in ' + (/asc/.test(sort.name) ? 'ascending' : 'descending') + ' order', node.properties[unsorted].loc.start ); } }); } |
| Function (anonymous_1286) | |
|---|---|
| ✓ Was called | ··· /** * Validates the order in object keys. * * Tyfunction(node) { var keys = node.properties.map(function(property) { return (property.key.name || property.key.value); }); var sorted = keys.slice(0).sort(sort); var unsorted; for (var i = 0; i < keys.length; i++) { if (keys[i] !== sorted[i]) { unsorted = i; break; } } if (undefined !== unsorted) { errors.add( 'Object keys must be in ' + (/asc/.test(sort.name) ? 'ascending' : 'descending') + ' order', node.properties[unsorted].loc.start ); } }); |
| Function (anonymous_1287) | |
|---|---|
| ✓ Was called | ··· /** * Validates the order in object keys.function(property) { return (property.key.name || property.key.value); }); |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | ··· /** * Validates the order in object keys. property.key.value); |
| ✓ Was returned | ··· /** * Validates the orproperty.key.name || property.key.value); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | ··· /** * Validates the order in object keys.{ unsorted = i; break; } |
| ✓ Negative was executed (else) | ··· /** * Validates } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | ··· /** * Validates the order in object ke{ errors.add( 'Object keys must be in ' + (/asc/.test(sort.name) ? 'ascending' : 'descending') + ' order', node.properties[unsorted].loc.start ); } |
| ✓ Negative was executed (else) | ··· /** * Valid }); |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | ··· /** * Validates the order in object keys. * * Types: `Boolean` or `St'ascending' : 'descending') + ' order', |
| ✓ Negative was returned (: ...) | ··· /** * Validates the order in object keys. * * Types: `Boolean` or `String` * * Va'descending') + ' order', |
| Function (anonymous_1288) | |
|---|---|
| ✓ Was called | /**··· * Enable valfunction() {}; |
| Function (anonymous_1289) | |
|---|---|
| ✓ Was called | /**··· * Enable vfunction(options) { assert( typeof options === 'string' && /^[ ]?,[ ]?$/.test(options), this.getOptionName() + ' option requires string value containing only a comma and optional spaces' ); this._separator = options; }, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Enable validation of separators betw/^[ ]?,[ ]?$/.test(options), |
| ✓ Was returned | /**··· * Enabltypeof options === 'string' && /^[ ]?,[ ]?$/.test(options), |
| Function (anonymous_1290) | |
|---|---|
| ✓ Was called | /**··· * Enable validfunction() { return 'validateParameterSeparator'; }, |
| Function (anonymous_1291) | |
|---|---|
| ✓ Was called | /**··· * Enabfunction(file, errors) { var separators = this._separator.split(','); var whitespaceBeforeComma = Boolean(separators.shift()); var whitespaceAfterComma = Boolean(separators.pop()); file.iterateNodesByType(['FunctionDeclaration', 'FunctionExpression'], function(node) { node.params.forEach(function(paramNode) { var prevParamToken = file.getFirstNodeToken(paramNode); var punctuatorToken = file.getNextToken(prevParamToken); if (punctuatorToken.value === ',') { if (whitespaceBeforeComma) { errors.assert.spacesBetween({ token: prevParamToken, nextToken: punctuatorToken, exactly: 1, message: 'One space required after function parameter \'' + prevParamToken.value + '\'' }); } else { errors.assert.noWhitespaceBetween({ token: prevParamToken, nextToken: punctuatorToken, message: 'Unexpected space after function parameter \'' + prevParamToken.value + '\'' }); } var nextParamToken = file.getNextToken(punctuatorToken); if (whitespaceAfterComma) { errors.assert.spacesBetween({ token: punctuatorToken, nextToken: nextParamToken, exactly: 1, message: 'One space required before function parameter \'' + nextParamToken.value + '\'' }); } else { errors.assert.noWhitespaceBetween({ token: punctuatorToken, nextToken: nextParamToken, message: 'Unexpected space before function parameter \'' + nextParamToken.value + '\'' }); } } }); }); } |
| Function (anonymous_1292) | |
|---|---|
| ✓ Was called | /**··· * Enable validation of separators between function parameters. Will ignorefunction(node) { node.params.forEach(function(paramNode) { var prevParamToken = file.getFirstNodeToken(paramNode); var punctuatorToken = file.getNextToken(prevParamToken); if (punctuatorToken.value === ',') { if (whitespaceBeforeComma) { errors.assert.spacesBetween({ token: prevParamToken, nextToken: punctuatorToken, exactly: 1, message: 'One space required after function parameter \'' + prevParamToken.value + '\'' }); } else { errors.assert.noWhitespaceBetween({ token: prevParamToken, nextToken: punctuatorToken, message: 'Unexpected space after function parameter \'' + prevParamToken.value + '\'' }); } var nextParamToken = file.getNextToken(punctuatorToken); if (whitespaceAfterComma) { errors.assert.spacesBetween({ token: punctuatorToken, nextToken: nextParamToken, exactly: 1, message: 'One space required before function parameter \'' + nextParamToken.value + '\'' }); } else { errors.assert.noWhitespaceBetween({ token: punctuatorToken, nextToken: nextParamToken, message: 'Unexpected space before function parameter \'' + nextParamToken.value + '\'' }); } } }); }); |
| Function (anonymous_1293) | |
|---|---|
| ✓ Was called | /**··· * Enable validation of sepafunction(paramNode) { var prevParamToken = file.getFirstNodeToken(paramNode); var punctuatorToken = file.getNextToken(prevParamToken); if (punctuatorToken.value === ',') { if (whitespaceBeforeComma) { errors.assert.spacesBetween({ token: prevParamToken, nextToken: punctuatorToken, exactly: 1, message: 'One space required after function parameter \'' + prevParamToken.value + '\'' }); } else { errors.assert.noWhitespaceBetween({ token: prevParamToken, nextToken: punctuatorToken, message: 'Unexpected space after function parameter \'' + prevParamToken.value + '\'' }); } var nextParamToken = file.getNextToken(punctuatorToken); if (whitespaceAfterComma) { errors.assert.spacesBetween({ token: punctuatorToken, nextToken: nextParamToken, exactly: 1, message: 'One space required before function parameter \'' + nextParamToken.value + '\'' }); } else { errors.assert.noWhitespaceBetween({ token: punctuatorToken, nextToken: nextParamToken, message: 'Unexpected space before function parameter \'' + nextParamToken.value + '\'' }); } } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Enable validation of separators between func{ if (whitespaceBeforeComma) { errors.assert.spacesBetween({ token: prevParamToken, nextToken: punctuatorToken, exactly: 1, message: 'One space required after function parameter \'' + prevParamToken.value + '\'' }); } else { errors.assert.noWhitespaceBetween({ token: prevParamToken, nextToken: punctuatorToken, message: 'Unexpected space after function parameter \'' + prevParamToken.value + '\'' }); } var nextParamToken = file.getNextToken(punctuatorToken); if (whitespaceAfterComma) { errors.assert.spacesBetween({ token: punctuatorToken, nextToken: nextParamToken, exactly: 1, message: 'One space required before function parameter \'' + nextParamToken.value + '\'' }); } else { errors.assert.noWhitespaceBetween({ token: punctuatorToken, nextToken: nextParamToken, message: 'Unexpected space before function parameter \'' + nextParamToken.value + '\'' }); } } |
| ✓ Negative was executed (else) | /**··· * Enable val }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Enable validation of separators between { errors.assert.spacesBetween({ token: prevParamToken, nextToken: punctuatorToken, exactly: 1, message: 'One space required after function parameter \'' + prevParamToken.value + '\'' }); } else { |
| ✓ Negative was executed (else) | /**··· * Enable validation of{ errors.assert.noWhitespaceBetween({ token: prevParamToken, nextToken: punctuatorToken, message: 'Unexpected space after function parameter \'' + prevParamToken.value + '\'' }); } |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Enable validation of separators between{ errors.assert.spacesBetween({ token: punctuatorToken, nextToken: nextParamToken, exactly: 1, message: 'One space required before function parameter \'' + nextParamToken.value + '\'' }); } else { |
| ✓ Negative was executed (else) | /**··· * Enable validation of{ errors.assert.noWhitespaceBetween({ token: punctuatorToken, nextToken: nextParamToken, message: 'Unexpected space before function parameter \'' + nextParamToken.value + '\'' }); } |
| Function (anonymous_1294) | |
|---|---|
| ✓ Was called | /**··· * Requires afunction() {}; |
| Function (anonymous_1295) | |
|---|---|
| ✓ Was called | /**··· * Requiresfunction(quoteMark) { this._allowEscape = false; this._ignoreJSX = false; if (typeof quoteMark === 'object') { assert( typeof quoteMark.escape === 'boolean' && quoteMark.mark !== undefined, this.getOptionName() + ' option requires the "escape" and "mark" property to be defined' ); this._allowEscape = quoteMark.escape; if (quoteMark.ignoreJSX) { this._ignoreJSX = quoteMark.ignoreJSX; } quoteMark = quoteMark.mark; } assert( quoteMark === '"' || quoteMark === '\'' || quoteMark === true, this.getOptionName() + ' option requires \'"\', "\'", or boolean true' ); assert( quoteMark === '"' || quoteMark === '\'' || quoteMark === true, this.getOptionName() + ' option requires \'"\', "\'", or boolean true' ); this._quoteMark = quoteMark; }, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires all quote marks to be eithe{ assert( typeof quoteMark.escape === 'boolean' && quoteMark.mark !== undefined, this.getOptionName() + ' option requires the "escape" and "mark" property to be defined' ); this._allowEscape = quoteMark.escape; if (quoteMark.ignoreJSX) { this._ignoreJSX = quoteMark.ignoreJSX; } quoteMark = quoteMark.mark; } |
| ✓ Negative was executed (else) | /**··· * Re assert( |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires all quote marks to be either the suppliedquoteMark.mark !== undefined, |
| ✓ Was returned | /**··· * Requires typeof quoteMark.escape === 'boolean' && quoteMark.mark !== undefined, |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires all quote marks to be{ this._ignoreJSX = quoteMark.ignoreJSX; } |
| ✓ Negative was executed (else) | /**··· * Requir quoteMark = quoteMark.mark; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires all quote marks to be either the suppliquoteMark === true, |
| ✓ Was returned | /**··· * RequiquoteMark === '"' || quoteMark === '\'' || quoteMark === true, |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires all quote marks tquoteMark === '\'' || quoteMark === true, |
| ✓ Was returned | /**··· * RequiquoteMark === '"' || quoteMark === '\'' || quoteMark === true, |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires all quote marks to be either the suppliquoteMark === true, |
| ✓ Was returned | /**··· * RequiquoteMark === '"' || quoteMark === '\'' || quoteMark === true, |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires all quote marks tquoteMark === '\'' || quoteMark === true, |
| ✓ Was returned | /**··· * RequiquoteMark === '"' || quoteMark === '\'' || quoteMark === true, |
| Function (anonymous_1296) | |
|---|---|
| ✓ Was called | /**··· * Requires allfunction() { return 'validateQuoteMarks'; }, |
| Function (anonymous_1297) | |
|---|---|
| ✓ Was called | /**··· * Requfunction(file, errors) { var quoteMark = this._quoteMark; var allowEscape = this._allowEscape; var ignoreJSX = this._ignoreJSX; var opposite = { '"': '\'', '\'': '"' }; file.iterateTokensByType('String', function(token) { if ( ignoreJSX && file.getNodeByRange(token.range[0]).parentNode.type === 'JSXAttribute' ) { return; } var str = token.value; var mark = str[0]; var stripped = str.substring(1, str.length - 1); if (quoteMark === true) { quoteMark = mark; } if (mark !== quoteMark) { if (allowEscape && stripped.indexOf(opposite[mark]) > -1) { return; } errors.cast({ message: 'Invalid quote mark found', line: token.loc.start.line, column: token.loc.start.column, additional: token }); } }); }, |
| Function (anonymous_1298) | |
|---|---|
| ✓ Was called | /**··· * Requires all quote marks to be eithefunction(token) { if ( ignoreJSX && file.getNodeByRange(token.range[0]).parentNode.type === 'JSXAttribute' ) { return; } var str = token.value; var mark = str[0]; var stripped = str.substring(1, str.length - 1); if (quoteMark === true) { quoteMark = mark; } if (mark !== quoteMark) { if (allowEscape && stripped.indexOf(opposite[mark]) > -1) { return; } errors.cast({ message: 'Invalid quote mark found', line: token.loc.start.line, column: token.loc.start.column, additional: token }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Require{ return; } |
| ✓ Negative was executed (else) | /**··· * Requir var str = token.value; |
| Branch LogicalExpression | |
|---|---|
| ✓ Was returned | /**··· * Requires file.getNodeByRange(token.range[0]).parentNode.type === 'JSXAttribute' |
| ✓ Was returned | /**··· * Requires ignoreJSX && |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires all quote marks to b{ quoteMark = mark; } |
| ✓ Negative was executed (else) | /**··· * Requir if (mark !== quoteMark) { |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires all quote marks to b{ if (allowEscape && stripped.indexOf(opposite[mark]) > -1) { return; } errors.cast({ message: 'Invalid quote mark found', line: token.loc.start.line, column: token.loc.start.column, additional: token }); } |
| ✓ Negative was executed (else) | /**··· * Requir }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * Requires all quote marks to be either the supplied value, or consis{ return; } |
| ✓ Negative was executed (else) | /**··· * Requires a errors.cast({ |
| Branch LogicalExpression | |
| ✓ Was returned | /**··· * Requires all quote marks to stripped.indexOf(opposite[mark]) > -1) { |
| ✓ Was returned | /**··· * Requires all allowEscape && stripped.indexOf(opposite[mark]) > -1) { |
| Function (anonymous_1299) | |
|---|---|
| ✓ Was called | /**··· * Reqfunction(file, error) { var token = error.additional; var fixer = require(this._quoteMark === '"' ? 'to-double-quotes' : 'to-single-quotes'); token.value = fixer(token.value); } |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | /**··· * Requires all quote marks to be either the suppl'to-double-quotes' : 'to-single-quotes'); |
| ✓ Negative was returned (: ...) | /**··· * Requires all quote marks to be either the supplied value, or consist'to-single-quotes'); |
| Function escapeAttrValue | |
|---|---|
| ✓ Was called | function escapeAttrValue(attrValue) {··· return String(attrValue) .replace(/&/g, '&') .replace(/"/g, '"') .replace(/</g, '<') .replace(/>/g, '>'); } |
| Function (anonymous_1301) | |
|---|---|
| ✓ Was called | function escapeAtfunction(errorCollection) {··· console.log('<?xml version="1.0" encoding="utf-8"?>\n<checkstyle version="4.3">'); errorCollection.forEach(function(errors) { console.log(' <file name="' + escapeAttrValue(errors.getFilename()) + '">'); errors.getErrorList().forEach(function(error) { console.log( ' <error ' + 'line="' + error.line + '" ' + 'column="' + (error.column + 1) + '" ' + 'severity="error" ' + 'message="' + escapeAttrValue(error.message) + '" ' + 'source="jscs" />' ); }); console.log(' </file>'); }); console.log('</checkstyle>'); }; |
| Function (anonymous_1302) | |
|---|---|
| ✓ Was called | function escapeAttrValue(attfunction(errors) {··· console.log(' <file name="' + escapeAttrValue(errors.getFilename()) + '">'); errors.getErrorList().forEach(function(error) { console.log( ' <error ' + 'line="' + error.line + '" ' + 'column="' + (error.column + 1) + '" ' + 'severity="error" ' + 'message="' + escapeAttrValue(error.message) + '" ' + 'source="jscs" />' ); }); console.log(' </file>'); }); |
| Function (anonymous_1303) | |
|---|---|
| ✓ Was called | function escapeAttrValue(attrValue) {··· function(error) { console.log( ' <error ' + 'line="' + error.line + '" ' + 'column="' + (error.column + 1) + '" ' + 'severity="error" ' + 'message="' + escapeAttrValue(error.message) + '" ' + 'source="jscs" />' ); }); |
| Function (anonymous_1304) | |
|---|---|
| ✓ Was called | /**··· * @param {Erfunction(errorsCollection) { var errorCount = 0; /** * Formatting every error set. */ errorsCollection.forEach(function(errors) { if (!errors.isEmpty()) { /** * Formatting every single error. */ errors.getErrorList().forEach(function(error) { errorCount++; console.log(errors.explainError(error, true) + '\n'); }); } }); if (errorCount) { /** * Printing summary. */ console.log('\n' + errorCount + ' code style ' + (errorCount === 1 ? 'error' : 'errors') + ' found.'); } }; |
| Function (anonymous_1305) | |
|---|---|
| ✓ Was called | /**··· * @param {Errors[]} errofunction(errors) { if (!errors.isEmpty()) { /** * Formatting every single error. */ errors.getErrorList().forEach(function(error) { errorCount++; console.log(errors.explainError(error, true) + '\n'); }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * @param {Errors[]} errors{ /** * Formatting every single error. */ errors.getErrorList().forEach(function(error) { errorCount++; console.log(errors.explainError(error, true) + '\n'); }); } |
| ✓ Negative was executed (else) | /**··· * @p }); |
| Function (anonymous_1306) | |
|---|---|
| ✓ Was called | /**··· * @param {Errors[]} errorsCollection function(error) { errorCount++; console.log(errors.explainError(error, true) + '\n'); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * @param {Error{ /** * Printing summary. */ console.log('\n' + errorCount + ' code style ' + (errorCount === 1 ? 'error' : 'errors') + ' found.'); } |
| ✓ Negative was executed (else) | /**··· }; |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | /**··· * @param {Errors[]} errorsCollection */ module.exports = function(error'error' : 'errors') + ' found.'); |
| ✓ Negative was returned (: ...) | /**··· * @param {Errors[]} errorsCollection */ module.exports = function(errorsCollectio'errors') + ' found.'); |
| Function (anonymous_1307) | |
|---|---|
| ✓ Was called | var util = requirfunction(errorsCollection) {··· var errorCount = 0; /** * Formatting every error set. */ errorsCollection.forEach(function(errors) { var file = errors.getFilename(); if (!errors.isEmpty()) { errors.getErrorList().forEach(function(error) { errorCount++; console.log(util.format('%s: line %d, col %d, %s', file, error.line, error.column, error.message)); }); } }); }; |
| Function (anonymous_1308) | |
|---|---|
| ✓ Was called | var util = require('util');··· /function(errors) { var file = errors.getFilename(); if (!errors.isEmpty()) { errors.getErrorList().forEach(function(error) { errorCount++; console.log(util.format('%s: line %d, col %d, %s', file, error.line, error.column, error.message)); }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var util = require('util');··· /**{ errors.getErrorList().forEach(function(error) { errorCount++; console.log(util.format('%s: line %d, col %d, %s', file, error.line, error.column, error.message)); }); } |
| ✓ Negative was executed (else) | var util ··· }); |
| Function (anonymous_1309) | |
|---|---|
| ✓ Was called | var util = require('util');··· /** * @param function(error) { errorCount++; console.log(util.format('%s: line %d, col %d, %s', file, error.line, error.column, error.message)); }); |
| Function (anonymous_1310) | |
|---|---|
| ✓ Was called | /**··· * inlinesingfunction(errorsCollection) { errorsCollection.forEach(function(errors) { if (!errors.isEmpty()) { var file = errors.getFilename(); var out = errors.getErrorList().map(function(error) { return util.format('%s: line %d, col %d, %s', file, error.line, error.column, error.message); }); console.log(out.join('\n')); } }); }; |
| Function (anonymous_1311) | |
|---|---|
| ✓ Was called | /**··· * inlinesingle solves anfunction(errors) { if (!errors.isEmpty()) { var file = errors.getFilename(); var out = errors.getErrorList().map(function(error) { return util.format('%s: line %d, col %d, %s', file, error.line, error.column, error.message); }); console.log(out.join('\n')); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * inlinesingle solves an i{ var file = errors.getFilename(); var out = errors.getErrorList().map(function(error) { return util.format('%s: line %d, col %d, %s', file, error.line, error.column, error.message); }); console.log(out.join('\n')); } |
| ✓ Negative was executed (else) | /**··· * in }); |
| Function (anonymous_1312) | |
|---|---|
| ✓ Was called | /**··· * inlinesingle solves an issue that Windowsfunction(error) { return util.format('%s: line %d, col %d, %s', file, error.line, error.column, error.message); }); |
| Function (anonymous_1313) | |
|---|---|
| ✓ Was called | /**··· * @param {Erfunction(errorsCollection) { var jsonOutput = {}; var anyError = false; errorsCollection.forEach(function(errors) { var file = errors.getFilename(); var arr = jsonOutput[file] = []; if (!errors.isEmpty()) { anyError = true; } errors.getErrorList().forEach(function(error) { arr.push({ line: error.line, column: error.column + 1, message: error.message }); }); }); if (anyError) { console.log(JSON.stringify(jsonOutput)); } }; |
| Function (anonymous_1314) | |
|---|---|
| ✓ Was called | /**··· * @param {Errors[]} errofunction(errors) { var file = errors.getFilename(); var arr = jsonOutput[file] = []; if (!errors.isEmpty()) { anyError = true; } errors.getErrorList().forEach(function(error) { arr.push({ line: error.line, column: error.column + 1, message: error.message }); }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * @param {Errors[]} errors{ anyError = true; } |
| ✓ Negative was executed (else) | /**··· * @p errors.getErrorList().forEach(function(error) { |
| Function (anonymous_1315) | |
|---|---|
| ✓ Was called | /**··· * @param {Errors[]} errorsCollectfunction(error) { arr.push({ line: error.line, column: error.column + 1, message: error.message }); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * @param {Err{ console.log(JSON.stringify(jsonOutput)); } |
| ✓ Negative was executed (else) | /**··· }; |
| Function (anonymous_1316) | |
|---|---|
| ✓ Was called | var xml = requirefunction(errorCollection) {··· var i = 0; var testsuite = xml.create('testsuite'); testsuite.att('name', 'JSCS'); testsuite.att('tests', errorCollection.length); errorCollection.forEach(function(errors) { var errorsCount = errors.getErrorCount(); var testcase = testsuite.ele('testcase', { name: errors.getFilename(), failures: errorsCount }); i += errorsCount; errors.getErrorList().forEach(function(error) { testcase.ele('failure', {}, errors.explainError(error)); }); }); testsuite.att('failures', i); console.log(testsuite.end({pretty: true})); }; |
| Function (anonymous_1317) | |
|---|---|
| ✓ Was called | var xml = require('xmlbuildefunction(errors) {··· var errorsCount = errors.getErrorCount(); var testcase = testsuite.ele('testcase', { name: errors.getFilename(), failures: errorsCount }); i += errorsCount; errors.getErrorList().forEach(function(error) { testcase.ele('failure', {}, errors.explainError(error)); }); }); |
| Function (anonymous_1318) | |
|---|---|
| ✓ Was called | var xml = require('xmlbuilder');··· modufunction(error) { testcase.ele('failure', {}, errors.explainError(error)); }); |
| Function (anonymous_1319) | |
|---|---|
| ✓ Was called | /**··· * @param {Erfunction(errorsCollection) { var Table = require('cli-table'); var hasError = false; var errorsByRule = {}; var style = { 'padding-left': 0, 'padding-right': 0, 'head': ['yellow'], 'border': ['red'], 'compact': false }; var errorsByFileTable = new Table({ 'head': ['Path', 'Total Errors'], 'colAligns': [ 'middle', 'middle', 'middle' ], 'colWidths': [62, 18], 'style': style }); var errorsByRuleTable = new Table({ 'head': ['Rule', 'Total Errors', 'Files With Errors'], 'colAligns': [ 'middle', 'middle', 'middle' ], 'colWidths': [49, 12, 18], 'style': style }); errorsCollection.forEach(function(errors) { var fileName = errors.getFilename(); if (!errors.isEmpty()) { hasError = true; errorsByFileTable.push([fileName, errors.getErrorCount()]); errors.getErrorList().forEach(function(error) { if (error.rule in errorsByRule) { errorsByRule[error.rule] .count += 1; } else { errorsByRule[error.rule] = { count: 1, files: {} }; } errorsByRule[error.rule].files[fileName] = 1; }); } }); var totalErrors = 0; var totalFilesWithErrors = 0; Object.getOwnPropertyNames(errorsByRule).forEach(function(ruleName) { var fileCount = Object.getOwnPropertyNames(errorsByRule[ruleName].files).length; errorsByRuleTable.push([ruleName, errorsByRule[ruleName].count, fileCount]); totalErrors += errorsByRule[ruleName].count; totalFilesWithErrors += fileCount; }); errorsByRuleTable.push(['All', totalErrors, totalFilesWithErrors]); if (hasError === false) { console.log('No code style errors found.'); } else { console.log(errorsByFileTable.toString()); console.log(errorsByRuleTable.toString()); } }; |
| Function (anonymous_1320) | |
|---|---|
| ✓ Was called | /**··· * @param {Errors[]} errofunction(errors) { var fileName = errors.getFilename(); if (!errors.isEmpty()) { hasError = true; errorsByFileTable.push([fileName, errors.getErrorCount()]); errors.getErrorList().forEach(function(error) { if (error.rule in errorsByRule) { errorsByRule[error.rule] .count += 1; } else { errorsByRule[error.rule] = { count: 1, files: {} }; } errorsByRule[error.rule].files[fileName] = 1; }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * @param {Errors[]} errors{ hasError = true; errorsByFileTable.push([fileName, errors.getErrorCount()]); errors.getErrorList().forEach(function(error) { if (error.rule in errorsByRule) { errorsByRule[error.rule] .count += 1; } else { errorsByRule[error.rule] = { count: 1, files: {} }; } errorsByRule[error.rule].files[fileName] = 1; }); } |
| ✓ Negative was executed (else) | /**··· * @p }); |
| Function (anonymous_1321) | |
|---|---|
| ✓ Was called | /**··· * @param {Errors[]} errorsCollection function(error) { if (error.rule in errorsByRule) { errorsByRule[error.rule] .count += 1; } else { errorsByRule[error.rule] = { count: 1, files: {} }; } errorsByRule[error.rule].files[fileName] = 1; }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * @param {Errors[]} errorsCollection */ mo{ errorsByRule[error.rule] .count += 1; } else { |
| ✓ Negative was executed (else) | /**··· * @param {Errors[]{ errorsByRule[error.rule] = { count: 1, files: {} }; } |
| Function (anonymous_1322) | |
|---|---|
| ✓ Was called | /**··· * @param {Errors[]} errorsCollection */ module.function(ruleName) { var fileCount = Object.getOwnPropertyNames(errorsByRule[ruleName].files).length; errorsByRuleTable.push([ruleName, errorsByRule[ruleName].count, fileCount]); totalErrors += errorsByRule[ruleName].count; totalFilesWithErrors += fileCount; }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * @param {Errors[]} err{ console.log('No code style errors found.'); } else { |
| ✓ Negative was executed (else) | /**··· * @par{ console.log(errorsByFileTable.toString()); console.log(errorsByRuleTable.toString()); } |
| Function (anonymous_1323) | |
|---|---|
| ✓ Was called | /**··· * @param {Erfunction(errorsCollection) { var errorCount = 0; /** * Formatting every error set. */ errorsCollection.forEach(function(errors) { if (!errors.isEmpty()) { /** * Formatting every single error. */ errors.getErrorList().forEach(function(error) { errorCount++; console.log(errors.explainError(error) + '\n'); }); } }); if (errorCount) { /** * Printing summary. */ console.log('\n' + errorCount + ' code style ' + (errorCount === 1 ? 'error' : 'errors') + ' found.'); } }; |
| Function (anonymous_1324) | |
|---|---|
| ✓ Was called | /**··· * @param {Errors[]} errofunction(errors) { if (!errors.isEmpty()) { /** * Formatting every single error. */ errors.getErrorList().forEach(function(error) { errorCount++; console.log(errors.explainError(error) + '\n'); }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * @param {Errors[]} errors{ /** * Formatting every single error. */ errors.getErrorList().forEach(function(error) { errorCount++; console.log(errors.explainError(error) + '\n'); }); } |
| ✓ Negative was executed (else) | /**··· * @p }); |
| Function (anonymous_1325) | |
|---|---|
| ✓ Was called | /**··· * @param {Errors[]} errorsCollection function(error) { errorCount++; console.log(errors.explainError(error) + '\n'); }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | /**··· * @param {Error{ /** * Printing summary. */ console.log('\n' + errorCount + ' code style ' + (errorCount === 1 ? 'error' : 'errors') + ' found.'); } |
| ✓ Negative was executed (else) | /**··· }; |
| Branch ConditionalExpression | |
|---|---|
| ✓ Positive was returned (? ...) | /**··· * @param {Errors[]} errorsCollection */ module.exports = function(error'error' : 'errors') + ' found.'); |
| ✓ Negative was returned (: ...) | /**··· * @param {Errors[]} errorsCollection */ module.exports = function(errorsCollectio'errors') + ' found.'); |
| Function (anonymous_1326) | |
|---|---|
| ✓ Was called | var util = requirfunction(errorsCollection) {··· errorsCollection.forEach(function(errors) { var file = errors.getFilename(); if (!errors.isEmpty()) { errors.getErrorList().forEach(function(error) { console.log(util.format('%s:%d:%d: %s', file, error.line, error.column, error.message)); }); } }); }; |
| Function (anonymous_1327) | |
|---|---|
| ✓ Was called | var util = require('util');··· function(errors) { var file = errors.getFilename(); if (!errors.isEmpty()) { errors.getErrorList().forEach(function(error) { console.log(util.format('%s:%d:%d: %s', file, error.line, error.column, error.message)); }); } }); |
| Branch IfStatement | |
|---|---|
| ✓ Positive was executed (if) | var util = require('util');··· /*{ errors.getErrorList().forEach(function(error) { console.log(util.format('%s:%d:%d: %s', file, error.line, error.column, error.message)); }); } |
| ✓ Negative was executed (else) | var util ··· }); |
| Function (anonymous_1328) | |
|---|---|
| ✓ Was called | var util = require('util');··· /** * @paramfunction(error) { console.log(util.format('%s:%d:%d: %s', file, error.line, error.column, error.message)); }); |